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.

122 lines
3.6 KiB

  1. /******************************************************************************
  2. * SpeakerData.h *
  3. *---------------*
  4. *
  5. *------------------------------------------------------------------------------
  6. * Copyright (C) 2000 Microsoft Corporation Date: 03/02/00
  7. * All Rights Reserved
  8. *
  9. ********************************************************************* PACOG ***/
  10. #ifndef __SPEAKERDATA_H_
  11. #define __SPEAKERDATA_H_
  12. #include "list.h"
  13. #include "unitsearch.h"
  14. #include <windows.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <atlbase.h>
  18. struct Epoch;
  19. struct SegInfo;
  20. struct UnitSamples;
  21. struct ChkDescript;
  22. class CClustTree;
  23. class CClusters;
  24. class CVqTable;
  25. class CSynth;
  26. // Defines parameters that are set for a defined voice
  27. // and the front end needs to know about.
  28. struct TtpParam
  29. {
  30. //Pitch Related pars.
  31. short baseLine;
  32. short refLine;
  33. short topLine;
  34. };
  35. class CSpeakerData
  36. {
  37. friend class CUnitSearch;
  38. public:
  39. static CSpeakerData* ClassFactory(const char* pszFileName, bool fCheckVersion);
  40. void AddRef();
  41. void Release();
  42. const char* Name();
  43. int GetSampFreq ();
  44. int GetSampFormat ();
  45. void SetF0Weight (float fWeight);
  46. void SetDurWeight (float fWeight);
  47. void SetRmsWeight (float fWeight);
  48. void SetLklWeight (float fWeight);
  49. void SetContWeight (float fWeight);
  50. void SetSameWeight (float fWeight);
  51. void SetPhBdrWeight (float fWeight);
  52. void SetF0BdrWeight (float fWeight);
  53. bool GetSynthMethod () { return m_fWaveConcat;}
  54. bool GetPhoneSetFlag () { return m_fMSPhoneSet;}
  55. void SetFrontEndFlag () { m_fMSEntropic = true; }
  56. bool GetFrontEndFlag () { return m_fMSEntropic; }
  57. void ResetRunTime () {m_dRumTime = 0;}
  58. void PreComputeDist();
  59. void GetTtpParam (int* piBaseLine, int* piRefLine, int* piTopLine);
  60. int GetStateCount (const char* pszCluster);
  61. int GetEquivalentCount (const char* pszCluster, int iStateNum);
  62. int GetEquivalent(SegInfo** ppSegInfo);
  63. CSynth* GetUnit (ChkDescript* pChunk);
  64. Weights GetWeights ();
  65. private:
  66. CSpeakerData(const char* pszFileName);
  67. ~CSpeakerData();
  68. int Load (bool fCheckVersion);
  69. int LoadFileNames (FILE* fp);
  70. int LoadTtpParam (FILE* fp);
  71. int LoadWeights (FILE* fp);
  72. int LoadNewWeights (FILE* fp);
  73. int LoadSamples (FILE* fp);
  74. void FreeSamples ();
  75. CSynth* UnitFromFile (ChkDescript* pChunk);
  76. CSynth* UnitFromMemory (ChkDescript* pChunk);
  77. int ReadSamples (const char* pszPathName, double dFrom, double dTo,
  78. short** ppnSamples, int* piNumSamples,
  79. Epoch** ppEpochs, int* piNumEpochs, int* piSampFreq);
  80. // Member data
  81. static CList<CSpeakerData*> m_speakers;
  82. static CComAutoCriticalSection m_critSect;
  83. char m_pszFileName[_MAX_PATH+1];
  84. int m_iRefCount;
  85. int m_iSampFreq;
  86. int m_iFormat;
  87. double m_dRumTime;
  88. CClustTree* m_pTrees;
  89. CClusters* m_pClusters;
  90. TtpParam m_ttpPar;
  91. CVqTable* m_pVq;
  92. CDynString* m_pFileNames;
  93. int m_iNumFileNames;
  94. UnitSamples* m_pUnits;
  95. int m_iNumUnits;
  96. Weights m_weights;
  97. bool m_fWaveConcat;
  98. bool m_fMSPhoneSet;
  99. bool m_fMSEntropic; // do we use MS_Entropic FrontEnd
  100. };
  101. #endif