classes.tex
上传用户:zhaopin
上传日期:2007-01-07
资源大小:79k
文件大小:12k
源码类别:

语音合成与识别

开发平台:

Visual C++

  1. chapter{Class reference}label{classes}
  2. setheader{{it CHAPTER thechapter}}{}{}{}{}{{it CHAPTER thechapter}}%
  3. setfooter{thepage}{}{}{}{}{thepage}
  4. section{class{CSpeech}}label{cspeech}
  5. CSpeech is used to control SAPI and also to receive feedback. If you wish to receive feedback,
  6. derive a new class and override one or more On... functions.
  7. Note that the MFC-conformant types CString and BOOL are used. If you are using wxWindows,
  8. these are actually wxString and Bool.
  9. wxheading{Member functions}
  10. membersection{CSpeech::CSpeech}label{cspeechconstr}
  11. func{}{CSpeech}{void}
  12. Constructs a new speech object. Call helpref{CSpeech::Init}{cspeechinit} to initialize
  13. the object and helpref{CSpeech::Terminate}{cspeechterminate} to terminate the object.
  14. membersection{CSpeech::destruct{CSpeech}}
  15. func{}{destruct{CSpeech}}{void}
  16. Destructor.
  17. membersection{CSpeech::AboutDialog}label{cspeechaboutdialog}
  18. func{BOOL}{AboutDialog}{param{window_t }{parentWindow}, param{const CString& }{title = ""}}
  19. Invokes the 'About' dialog for the current engine.
  20. {it parentWindow} is an HWND in the current implementation.
  21. {it title} is the title that should appear in the dialog. Current this is not used,
  22. and the engine supplies the title.
  23. Returns FALSE if the engine does not implement it, or there was some other problem.
  24. membersection{CSpeech::Default}label{cspeechdefault}
  25. func{BOOL}{Default}{void}
  26. Sets the text-to-speech engine to its defaults by innjecting a RST tag.
  27. membersection{CSpeech::Enumerate}label{cspeechenumerate}
  28. func{BOOL}{EnumerateModes}{void}
  29. Enumerates all the possible modes (voices). This is called by helpref{CSpeech::Init}{cspeechinit} but
  30. may be called again if, for example, the user has installed or removed engines.
  31. membersection{CSpeech::FindMode}label{cspeechfindmode}
  32. func{int}{FindMode}{param{const CString& }{modeName}}
  33. Finds the index of the mode matching the given name.
  34. The return value will be between zero and the number returned
  35. by helpref{CSpeech::GetModeCount}{cspeechgetmodecount}; or it will
  36. be -1 to indicate that the mode was not found.
  37. membersection{CSpeech::GeneralDialog}label{cspeechgeneraldialog}
  38. func{BOOL}{GeneralDialog}{param{window_t }{parentWindow}, param{const CString& }{title = ""}}
  39. Invokes the general settings dialog for the current engine.
  40. {it parentWindow} is an HWND in the current implementation.
  41. {it title} is the title that should appear in the dialog. Current this is not used,
  42. and the engine supplies the title.
  43. Returns FALSE if the engine does not implement it, or there was some other problem.
  44. membersection{CSpeech::GetMaxPitch}label{cspeechgetmaxpitch}
  45. constfunc{int}{GetMaxPitch}{void}
  46. Returns the maximum pitch value.
  47. membersection{CSpeech::GetMaxSpeed}label{cspeechgetmaxspeed}
  48. constfunc{int}{GetMaxSpeed}{void}
  49. Returns the maximum speed value.
  50. membersection{CSpeech::GetMaxVolume}label{cspeechgetmaxvolume}
  51. constfunc{int}{GetMaxVolume}{void}
  52. Returns the maximum volume value.
  53. membersection{CSpeech::GetMinPitch}label{cspeechgetminpitch}
  54. constfunc{int}{GetMinPitch}{void}
  55. Returns the minimum pitch value.
  56. membersection{CSpeech::GetMinSpeed}label{cspeechgetminspeed}
  57. constfunc{int}{GetMinSpeed}{void}
  58. Returns the minimum speed value.
  59. membersection{CSpeech::GetMinVolume}label{cspeechgetminvolume}
  60. constfunc{int}{GetMinVolume}{void}
  61. Returns the minimum volume value.
  62. membersection{CSpeech::GetModeCount}label{cspeechgetmodecount}
  63. constfunc{int}{GetModeCount}{void}
  64. Returns the number of modes (voices) currently supported.
  65. membersection{CSpeech::GetModeFeatures}label{cspeechgetmodefeatures}
  66. constfunc{long}{GetModeFeatures}{param{int}{ mode}}
  67. Returns a bitlist of the features supported by this mode (voice) at index {it mode}.
  68. {it mode} can be between zero and the number returned
  69. by helpref{CSpeech::GetModeCount}{cspeechgetmodecount}.
  70. The return value types will eventually be replaced by values independent of
  71. the SAPI header file.
  72. membersection{CSpeech::GetModeName}label{cspeechgetmodename}
  73. constfunc{CString}{GetModeName}{param{int}{ mode}}
  74. Returns the name of the mode (voice) at index {it mode}.
  75. {it mode} can be between zero and the number returned
  76. by helpref{CSpeech::GetModeCount}{cspeechgetmodecount}.
  77. membersection{CSpeech::Init}label{cspeechinit}
  78. func{BOOL}{Init}{void}
  79. Initializes and enumerates modes. You must call this function
  80. before calling other member functions.
  81. See also helpref{CSpeech::Terminate}{cspeechterminate}.
  82. membersection{CSpeech::Inject}label{cspeechinject}
  83. func{BOOL}{Inject}{param{const CString& }{text}}
  84. Injects text-to-speech control tags into the text currently being spoken.
  85. A string can contain multiple tags, separated by spaces.
  86. Returns TRUE if successful, FALSE otherwise.
  87. membersection{CSpeech::LexiconDialog}label{cspeechlexicondialog}
  88. func{BOOL}{LexiconDialog}{param{window_t }{parentWindow}, param{const CString& }{title = ""}}
  89. Invokes the lexicon dialog for the current engine.
  90. {it parentWindow} is an HWND in the current implementation.
  91. {it title} is the title that should appear in the dialog. Current this is not used,
  92. and the engine supplies the title.
  93. Returns FALSE if the engine does not implement it, or there was some other problem.
  94. membersection{CSpeech::OnAttribChanged}label{cspeechonattribchanged}
  95. func{virtual BOOL}{OnAttributeChanged}{param{long}{ attribId}}
  96. Called when an attribute has changed.
  97. membersection{CSpeech::OnAudioStart}label{cspeechonaudiostart}
  98. func{virtual BOOL}{OnAudioStart}{param{timestamp_t}{ timeStamp}}
  99. Called when audio output starts.
  100. membersection{CSpeech::OnAudioStop}label{cspeechonaudiostop}
  101. func{virtual BOOL}{OnAudioStop}{param{timestamp_t}{ timeStamp}}
  102. Called when audio output stops.
  103. membersection{CSpeech::OnBookMark}label{cspeechonbookmark}
  104. func{virtual BOOL}{OnBookMark}{param{timestamp_t}{ timeStamp}, param{long}{ markNum}}
  105. Called when a bookmark is encountered.
  106. membersection{CSpeech::OnTextDataDone}label{cspeechontextdatadone}
  107. func{virtual BOOL}{OnTextDataStarted}{param{timestamp_t}{ timeStamp}, param{long}{ flags}}
  108. Called when utterance of the text data has completed.
  109. Note: this doesn't seem to be called by SAPI. Use helpref{CSpeech::OnAudioStop}{cspeechonaudiostop} instead.
  110. membersection{CSpeech::OnTextDataStarted}label{cspeechontextdatastarted}
  111. func{virtual BOOL}{OnTextDataStarted}{param{timestamp_t}{ timeStamp}}
  112. Called when the text data has been sent to the engine.
  113. Note: this doesn't seem to be called by SAPI. Use helpref{CSpeech::OnAudioStart}{cspeechonaudiostart} instead.
  114. membersection{CSpeech::OnVisual}label{cspeechonvisual}
  115. func{virtual BOOL}{OnVisual}{param{timestamp_t}{ timeStamp}, param{char}{ IPAPhoneme},rtfsp
  116. param{char}{ enginePhoneme}, param{long}{ hints}, param{const CSpeechMouth&}{ mouth}}
  117. Called to give the application the chance to draw a visual representation of the current utterance.
  118. membersection{CSpeech::OnWordPosition}label{cspeechonwordposition}
  119. func{virtual BOOL}{OnWordPosition}{param{timestamp_t}{ timeStamp}, param{long}{ byteOffset}}
  120. Notifies the application of the word that is currently being played.
  121. membersection{CSpeech::Pause}label{cspeechpause}
  122. func{BOOL}{Pause}{param{BOOL}{ pause}}
  123. If {it pause} is TRUE, the speech will be paused. If {it pause} is FALSE, the speech
  124. is resumed.
  125. Returns TRUE if successful, FALSE otherwise.
  126. membersection{CSpeech::Reset}label{cspeechreset}
  127. func{BOOL}{Reset}{void}
  128. Resets the text-to-speech engine.
  129. membersection{CSpeech::Say}label{cspeechsay}
  130. func{BOOL}{Say}{param{const CString& }{text}, param{BOOL }{tagged = FALSE}}
  131. Utters the given text. If {it tagged} is TRUE, the text is treated as tagged (there are
  132. SAPI tags inserted for controlling emphasis etc.)
  133. Returns TRUE if successful, FALSE otherwise.
  134. membersection{CSpeech::SetMode}label{cspeechsetmode}
  135. func{BOOL}{SetMode}{param{int}{ mode}}
  136. Sets the current mode (voice).
  137. {it mode} can be between zero and the number returned
  138. by helpref{CSpeech::GetModeCount}{cspeechgetmodecount}.
  139. membersection{CSpeech::SetPitch}label{cspeechsetpitch}
  140. func{BOOL}{SetPitch}{param{int}{ pitch}}
  141. Sets the pitch. {it pitch} should be a value between
  142. the values returned by helpref{CSpeech::GetMinPitch}{cspeechgetminpitch} and
  143. rtfsphelpref{CSpeech::GetMaxPitch}{cspeechgetmaxpitch}.
  144. membersection{CSpeech::SetSpeed}label{cspeechsetspeed}
  145. func{BOOL}{SetSpeed}{param{long}{ speed}}
  146. Sets the speed. {it speed} should be a value between
  147. the values returned by helpref{CSpeech::GetMinSpeed}{cspeechgetminspeed} and
  148. rtfsphelpref{CSpeech::GetMaxSpeed}{cspeechgetmaxspeed}.
  149. membersection{CSpeech::SetVolume}label{cspeechsetvolume}
  150. func{BOOL}{SetVolume}{param{long}{ volume}}
  151. Sets the volume. {it volume} should be a value between
  152. the values returned by helpref{CSpeech::GetMinVolume}{cspeechgetminvolume} and
  153. rtfsphelpref{CSpeech::GetMaxVolume}{cspeechgetmaxvolume}.
  154. membersection{CSpeech::Terminate}label{cspeechterminate}
  155. func{BOOL}{Terminate}{void}
  156. Cleans up the CSpeech object and associated COM objects. You must call this function
  157. before the speech object is destroyed.
  158. See also helpref{CSpeech::Init}{cspeechinit}.
  159. membersection{CSpeech::TranslateDialog}label{cspeechtranslatedialog}
  160. func{BOOL}{TranslateDialog}{param{window_t }{parentWindow}, param{const CString& }{title = ""}}
  161. Invokes the translation dialog for the current engine, letting the user control symbols, currencies,
  162. abbreviations, and number-translation techniques.
  163. {it parentWindow} is an HWND in the current implementation.
  164. {it title} is the title that should appear in the dialog. Current this is not used,
  165. and the engine supplies the title.
  166. Returns FALSE if the engine does not implement it, or there was some other problem.
  167. section{class{CSpeechMouth}}label{cspeechmouth}
  168. CSpeechMouth is a class holding information about the mouth position, and is currently only
  169. used in helpref{CSpeech::OnVisual}{cspeechonvisual}.
  170. This class will be documented in more detail at a future date.
  171. wxheading{Data members}
  172. membersection{CSpeechMouth::m_mouthHeight}label{cspeechmouthmouthheight}
  173. member{int}{m_mouthHeight}
  174. Mouth height.
  175. membersection{CSpeechMouth::m_mouthWidth}label{cspeechmouthmouthwidth}
  176. member{int}{m_mouthWidth}
  177. Mouth width.
  178. membersection{CSpeechMouth::m_mouthUpturn}label{cspeechmouthmouthupturn}
  179. member{int}{m_mouthUpturn}
  180. Mouth upturn.
  181. membersection{CSpeechMouth::m_jawOpen}label{cspeechmouthjawopen}
  182. member{int}{m_jawOpen}
  183. Extent of the jaw.
  184. membersection{CSpeechMouth::m_teethUpperVisible}label{cspeechmouthteethuppervisible}
  185. member{int}{m_teethUpperVisible}
  186. Extent to which the upper teeth are visible.
  187. membersection{CSpeechMouth::m_teethLowerVisible}label{cspeechmouthteethlowervisible}
  188. member{int}{m_teethLowerVisible}
  189. Extent to which the lower teeth are visible.
  190. membersection{CSpeechMouth::m_tonguePosn}label{cspeechmouthtongueposn}
  191. member{int}{m_tonguePosn}
  192. Tongue position.
  193. membersection{CSpeechMouth::m_lipTension}label{cspeechmouthliptension}
  194. member{int}{m_lipTension}
  195. Lip tension.
  196. section{Data types}label{datatypes}
  197. The following data types have been defined for CSpeech.
  198. wxheading{timestamp_t}
  199. This is defined as u_int64_t.
  200. wxheading{window_t}
  201. This is defined as void*, and is converted to a HWND in the CSpeech implementation.