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.

98 lines
2.8 KiB

  1. /******************************************************************************
  2. * tips.h *
  3. *--------*
  4. *
  5. *------------------------------------------------------------------------------
  6. * Copyright (C) 2000 Microsoft Corporation Date: 03/02/00 - 12/4/00
  7. * All Rights Reserved
  8. *
  9. ********************************************************************* mplumpe was PACOG ***/
  10. #ifndef __TIPS_H_
  11. #define __TIPS_H_
  12. class CSynth;
  13. class CTips
  14. {
  15. friend class CSynth;
  16. public:
  17. static enum {LpTips = 1, RTips= 2};
  18. CTips(int iOptions);
  19. ~CTips();
  20. int Init (int iSampFormat, int iSampFreq);
  21. void SetGain (double dGain);
  22. double GetGain ();
  23. void NewSentence (float* pfF0, int iNumF0, int iF0SampFreq);
  24. int NewUnit (CSynth* pUnit);
  25. int Pending ();
  26. int NextPeriod (short** ppsSamples, int* piNumSamples);
  27. int SetBuffer ( double* pdSamples, int iNumSamples, int iCenter, double dDelay, double* pdLpcCoef);
  28. // Waveform concatenation buffer
  29. int SetWaveSeg ( double* pdSamples, int iNumSamples, double dGain );
  30. int GetWaveSeg ( double** ppdSamples, int* piNumSamples, double* pdGain );
  31. protected:
  32. int Prosody (CSynth* pUnit);
  33. int Synthesize (int iPeriodLen);
  34. int GetWindowedSignal (int whichBuffer, int periodLength, double** windowed, int* nWindowed);
  35. void HalfHanning (double* x, int xLen, double ampl, int whichHalf);
  36. static short ClipData (double x);
  37. bool LpcInit ();
  38. void LpcSynth( double* pdData, int iNumData);
  39. void LpcFreeAll();
  40. enum {WindowFirstHalf, WindowSecondHalf};
  41. static const double m_iDefaultPeriod;
  42. static const double m_dMinF0;
  43. int m_iSampFormat;
  44. int m_iSampFreq;
  45. double m_dGain;
  46. // Operation flags
  47. bool m_fLptips;
  48. bool m_fRtips;
  49. // Compute prosody Variables
  50. float* m_pfF0;
  51. int m_iNumF0;
  52. double m_dRunTime;
  53. double m_dF0SampFreq;
  54. double m_dF0TimeNext;
  55. double m_dF0TimeStep;
  56. double m_dF0Value;
  57. double m_dAcumF0;
  58. int m_iF0Idx;
  59. double m_dLastEpochTime;
  60. double m_dNewEpochTime;
  61. // Buffers for synthesis
  62. struct CBuffer {
  63. double* m_pdSamples;
  64. int m_iNumSamples;
  65. int m_iCenter;
  66. double m_dDelay;
  67. } m_aBuffer[2];
  68. // Lpc Synthesis
  69. int m_iLpcOrder;
  70. double* m_pdFiltMem;
  71. double* m_pdInterpCoef;
  72. double* m_pdNewCoef;
  73. double* m_pdLastCoef;
  74. // Holds current synthesis unit
  75. CSynth* m_pUnit;
  76. short* m_psSynthSamples;
  77. int m_iNumSynthSamples;
  78. static const int m_iHalfHanLen_c;
  79. double* m_adHalfHanning;
  80. };
  81. #endif