Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

  1. //
  2. // sptask.h
  3. // speech related class for mscandui
  4. //
  5. #ifndef SPTASK_H
  6. #define SPTASK_H
  7. #include "private.h"
  8. #include "sapi.h"
  9. #include "sphelper.h"
  10. #include "globals.h"
  11. #include "candui.h"
  12. #include "tes.h"
  13. #include "editcb.h"
  14. // SAPI5.0 speech notification interface
  15. //
  16. class CSpTask : public ISpNotifyCallback
  17. {
  18. public:
  19. CSpTask(CCandidateUI *pcui);
  20. ~CSpTask(void);
  21. // this has to be the first in vtable
  22. STDMETHODIMP NotifyCallback( WPARAM wParam, LPARAM lParam );
  23. HRESULT InitializeSAPIObjects();
  24. HRESULT InitializeCallback();
  25. HRESULT _Activate(BOOL fActive);
  26. HRESULT _LoadGrammars(void);
  27. HRESULT _OnSpEventRecognition(CSpEvent &event);
  28. HRESULT _DoCommand(SPPHRASE *pPhrase, LANGID langid);
  29. HRESULT _DoDictation(ISpRecoResult *pResult);
  30. WCHAR *_GetCmdFileName(LANGID langid);
  31. BOOL IsSpeechInitialized(void) { return m_fSapiInitialized; }
  32. HRESULT InitializeSpeech();
  33. HRESULT _GetSapilayrEngineInstance(ISpRecognizer **pRecoEngine);
  34. void _ReleaseGrammars(void);
  35. private:
  36. // SAPI 50 object pointers
  37. CComPtr<ISpRecoContext> m_cpRecoCtxt;
  38. CComPtr<ISpRecognizer> m_cpRecoEngine;
  39. CComPtr<ISpVoice> m_cpVoice;
  40. CComPtr<ISpRecoGrammar> m_cpCmdGrammar;
  41. CComPtr<ISpRecoGrammar> m_cpDictGrammar;
  42. // TRUE if sapi is initialized
  43. BOOL m_fSapiInitialized;
  44. // other data members
  45. DWORD m_dwStatus;
  46. BOOL m_fActive;
  47. // save the current user LANGID for the fallback case
  48. LANGID m_langid;
  49. WCHAR m_szCmdFile[MAX_PATH];
  50. CCandidateUI *m_pcui;
  51. BOOL m_fInCallback;
  52. };
  53. #endif // SPTASK_H