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.

102 lines
3.0 KiB

  1. /******************************************************************************
  2. * Backend.h *
  3. *-----------*
  4. * Backend interface definition
  5. *------------------------------------------------------------------------------
  6. * Copyright (C) 1998 Entropic, Inc
  7. * Copyright (C) 2000 Microsoft Corporation Date: 03/02/00
  8. * All Rights Reserved
  9. *
  10. ********************************************************************* PACOG ***/
  11. #ifndef __BACKEND_H_
  12. #define __BACKEND_H_
  13. #define PHONE_MAX_LEN 10
  14. #define CHUNK_NAME_MAX_LEN 1024
  15. struct Phone
  16. {
  17. char phone[PHONE_MAX_LEN];
  18. short f0; //Average f0;
  19. int isWordEnd;
  20. double end;
  21. };
  22. struct ChkDescript
  23. {
  24. char name[ CHUNK_NAME_MAX_LEN ];
  25. double end;
  26. double from;
  27. double to;
  28. double gain;
  29. double targF0;
  30. double srcF0;
  31. double f0Ratio;
  32. union {
  33. int chunkIdx;
  34. const char* fileName;
  35. } chunk;
  36. int isFileName;
  37. };
  38. class CSynth;
  39. class CSlm
  40. {
  41. public:
  42. static enum {UseGain=1, Blend= 2, DynSearch= 4, UseTargetF0= 8};
  43. virtual ~CSlm() {};
  44. virtual int Load (const char *pszFileName, bool fCheckVersion) = 0;
  45. virtual void Unload () = 0;
  46. virtual bool GetSynthMethod() = 0;
  47. virtual int GetSampFreq () = 0;
  48. virtual int GetSampFormat () = 0;
  49. virtual bool GetPhoneSetFlag () = 0;
  50. virtual void SetFrontEndFlag () = 0;
  51. virtual void SetF0Weight (float fWeight) = 0;
  52. virtual void SetDurWeight (float fWeight) = 0;
  53. virtual void SetRmsWeight (float fWeight) = 0;
  54. virtual void SetLklWeight (float fWeight) = 0;
  55. virtual void SetContWeight (float fWeight) = 0;
  56. virtual void SetSameSegWeight (float fWeight) = 0;
  57. virtual void PreComputeDist() = 0;
  58. virtual void CalculateF0Ratio () = 0;
  59. virtual void GetNewF0 (float** ppfF0, int* piNumF0, int iF0SampFreq) = 0;
  60. virtual void GetTtpParam (int* piBaseLine, int* piRefLine, int* piTopLine) = 0;
  61. virtual int Process (Phone* phList, int nPh, double startTime) = 0;
  62. virtual CSynth* GetUnit (int iUnitIndex) = 0;
  63. virtual ChkDescript* GetChunk (int iChunkIndex) = 0; //For command line slm
  64. static CSlm* ClassFactory (int iOptions);
  65. };
  66. class CBackEnd {
  67. public:
  68. virtual ~CBackEnd() {};
  69. virtual int LoadTable (const char* pszFilePath, int iDebug = 0) = 0;
  70. virtual int GetSampFreq () = 0;
  71. virtual void SetGain (double dGain)= 0;
  72. virtual void SetF0SampFreq(int iF0SampFreq) = 0;
  73. virtual int NewPhoneString (Phone* pPhList, int iNumPh, float* pfNewF0, int iNumNewF0) = 0;
  74. virtual int OutputPending () = 0;
  75. virtual int GenerateOutput (short** ppnSamples, int* piNumSamples) = 0;
  76. virtual int GetChunk (ChkDescript** ppChunk) = 0;
  77. virtual void GetSpeakerInfo (int* piBaseLine, int* piRefLine, int* piTopLine) = 0;
  78. virtual bool GetPhoneSetFlag () = 0;
  79. virtual void SetFrontEndFlag () = 0;
  80. static CBackEnd* ClassFactory();
  81. };
  82. #endif