Source code of Windows XP (NT5)
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.

127 lines
4.1 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // PromptDb.h : Declaration of the CPromptDb
  3. //
  4. // Created by JOEM 04-2000
  5. // Copyright (C) 2000 Microsoft Corporation
  6. // All Rights Reserved
  7. //
  8. /////////////////////////////////////////////////////// JOEM 4-2000 //
  9. #ifndef __PROMPTDB_H_
  10. #define __PROMPTDB_H_
  11. #include "resource.h" // main symbols
  12. #include "common.h"
  13. #include "PEErr.h"
  14. #include "PromptEntry.h"
  15. #include "Hash.h"
  16. #include "fmtconvert.h"
  17. #include "tsm.h"
  18. #include <spddkhlp.h>
  19. #include <spcollec.h>
  20. // forward references
  21. class VapiIO;
  22. extern const IID IID_IPromptDb;
  23. // DB ACTIONS
  24. enum { DB_ADD = 1, DB_ACTIVATE, DB_UNLOAD };
  25. // DB_LOAD OPTIONS
  26. #define DB_LOAD 0
  27. #define DB_CREATE 1
  28. class CDb
  29. {
  30. public:
  31. CDb();
  32. ~CDb();
  33. WCHAR* pszPathName;
  34. WCHAR* pszTempName;
  35. WCHAR* pszLogicalName;
  36. CHash idHash;
  37. CHash textHash;
  38. };
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CPromptDb
  41. class ATL_NO_VTABLE CPromptDb :
  42. public CComObjectRootEx<CComMultiThreadModel>,
  43. public CComCoClass<CPromptDb, &CLSID_PromptDb>,
  44. public IPromptDb
  45. {
  46. public:
  47. DECLARE_REGISTRY_RESOURCEID(IDR_PROMPTDB)
  48. DECLARE_PROTECT_FINAL_CONSTRUCT()
  49. BEGIN_COM_MAP(CPromptDb)
  50. COM_INTERFACE_ENTRY(IPromptDb)
  51. END_COM_MAP()
  52. // Constructor/Destructor
  53. HRESULT FinalConstruct();
  54. void FinalRelease();
  55. public:
  56. // IPromptDb
  57. STDMETHOD(NewDb)(const WCHAR *logicalName, const WCHAR *pathName);
  58. STDMETHOD(AddDb)(const WCHAR *logicalName, const WCHAR *pathName, const WCHAR *pszIdSet, const USHORT loadOption);
  59. STDMETHOD(UnloadDb)(const WCHAR* pszLogicalName);
  60. STDMETHOD(ActivateDbName)(const WCHAR *pszLogicalName);
  61. STDMETHOD(ActivateDbNumber)(const USHORT unIndex);
  62. STDMETHOD(UpdateDb)(WCHAR* pszPath);
  63. STDMETHOD(CountDb)(USHORT *unCount);
  64. STDMETHOD(SearchDb)(const WCHAR* pszQuery, USHORT* unIdCount);
  65. STDMETHOD(RetrieveSearchItem)(const USHORT unId, const WCHAR** ppszId);
  66. STDMETHOD(GetLogicalName)(const WCHAR** ppszLogicalName);
  67. STDMETHOD(GetNextEntry)(USHORT* punId1, USHORT* punId2, IPromptEntry** ppIPE);
  68. STDMETHOD(FindEntry)(const WCHAR* id, IPromptEntry** ppIPE);
  69. STDMETHOD(NewEntry)(IPromptEntry** ppIPE);
  70. STDMETHOD(SaveEntry)(IPromptEntry* pIPE);
  71. STDMETHOD(RemoveEntry)(const WCHAR* id);
  72. STDMETHOD(OpenEntryFile)(IPromptEntry* pIPE, WAVEFORMATEX* pWaveFormatEx);
  73. STDMETHOD(CloseEntryFile)();
  74. STDMETHOD(GetPromptFormat)(WAVEFORMATEX** ppwf);
  75. STDMETHOD(SetOutputFormat)(const GUID * pOutputFormatId, const WAVEFORMATEX *pOutputFormat);
  76. STDMETHOD(SetEntryGain)(const double dEntryGain);
  77. STDMETHOD(SetXMLVolume)(const ULONG ulXMLVol);
  78. STDMETHOD(SetXMLRate)(const long lXMLRate);
  79. STDMETHOD(SendEntrySamples)(IPromptEntry* pIPE, ISpTTSEngineSite* pOutputSite, ULONG ulTextOffset, ULONG ulTextLen);
  80. private:
  81. STDMETHOD(SendEvent)(const SPEVENTENUM event, ISpTTSEngineSite* pOutputSite, const ULONG ulAudioOffset, const ULONG ulTextOffset, const ULONG ulTextLen);
  82. void ComputeRateAdj(const long lRate, float* flRate);
  83. STDMETHOD(ApplyGain)(const void* pvInBuff, void** ppvOutBuff, const int iNumSamples, double dGain);
  84. STDMETHOD(LoadDb)(const WCHAR* pszIdSet);
  85. STDMETHOD(LoadIdHash)(FILE* fp, const WCHAR* pszIdSet);
  86. STDMETHOD(IndexTextHash)();
  87. STDMETHOD(ExtractDouble)(WCHAR* line, const WCHAR* tag, double* value);
  88. STDMETHOD(ExtractString)(WCHAR* line, const WCHAR* tag, WCHAR** value);
  89. STDMETHOD(ReadEntry)(FILE* fp, CPromptEntry** ppEntry);
  90. STDMETHOD(WriteEntry)(FILE* fp, IPromptEntry* pIPE);
  91. STDMETHOD(TempName)();
  92. CPromptEntry* DuplicateEntry(const CPromptEntry* oldEntry);
  93. private:
  94. CSPArray<CDb*,CDb*> m_apDbList;
  95. CSPArray<CDynStr,CDynStr> m_aSearchList;
  96. CDb* m_pActiveDb;
  97. USHORT m_unIndex;
  98. volatile LONG m_vcRef;
  99. float m_flEntryGain;
  100. float m_flXMLVolume;
  101. float m_flXMLRateAdj;
  102. const GUID* m_pOutputFormatId;
  103. WAVEFORMATEX* m_pOutputFormat;
  104. CFmtConvert m_converter;
  105. CTsm* m_pTsm;
  106. VapiIO* m_pVapiIO;
  107. };
  108. #endif //__PROMPTDB_H_