Leaked source code of windows server 2003
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.

420 lines
12 KiB

  1. /*******************************************************************************
  2. * Data.cpp *
  3. *----------*
  4. * Description:
  5. * Constant data tables.
  6. *-------------------------------------------------------------------------------
  7. * Created By: mc Date: 03/12/99
  8. * Copyright (C) 1999 Microsoft Corporation
  9. * All Rights Reserved
  10. *
  11. *******************************************************************************/
  12. #include "stdafx.h"
  13. #ifndef AlloOps_H
  14. #include "AlloOps.h"
  15. #endif
  16. #ifndef __spttseng_h__
  17. #include "spttseng.h"
  18. #endif
  19. #ifndef Frontend_H
  20. #include "Frontend.h"
  21. #endif
  22. #pragma warning(disable : 4305)
  23. #pragma warning(disable : 4309)
  24. #define PUNCT_GAIN 1.67
  25. #define PUNCT_GAIN1 1.33
  26. #define SUB1_GAIN 1.00
  27. #define SUB2_GAIN 1.00
  28. // I don't understand why I had to add "extern" here.
  29. // If YOU do, please explain here for the rest of us:
  30. extern const float g_BoundryStretchTbl[] =
  31. {
  32. 1.0, // NULL_BOUNDARY = 0, // no boundary
  33. PUNCT_GAIN1, // PHRASE_BOUNDARY, // comma
  34. PUNCT_GAIN, // EXCLAM_BOUNDARY, // exclamatory utterance terminator
  35. PUNCT_GAIN, // YN_QUEST_BOUNDARY, // yes-no question terminator
  36. PUNCT_GAIN, // WH_QUEST_BOUNDARY, // yes-no question terminator
  37. PUNCT_GAIN, // DECLAR_BOUNDARY, // declarative terminator
  38. SUB1_GAIN, // PAREN_L_BOUNDARY, // left paren
  39. SUB1_GAIN, // PAREN_R_BOUNDARY, // right paren
  40. SUB1_GAIN, // QUOTE_L_BOUNDARY, // left quote
  41. SUB1_GAIN, // QUOTE_R_BOUNDARY, // right quote
  42. SUB1_GAIN, // PHONE_BOUNDARY, // Telephone number
  43. 1.30, // TOD_BOUNDARY, // Time-of-day
  44. SUB2_GAIN, // SUB_BOUNDARY_1, // NOTE: always put these at the end
  45. SUB2_GAIN, // SUB_BOUNDARY_2,
  46. SUB2_GAIN, // SUB_BOUNDARY_3,
  47. SUB2_GAIN, // SUB_BOUNDARY_4,
  48. SUB2_GAIN, // SUB_BOUNDARY_5,
  49. SUB2_GAIN, // SUB_BOUNDARY_6,
  50. SUB2_GAIN, // NUMBER_BOUNDARY,
  51. 1.0, // TAIL_BOUNDARY
  52. };
  53. extern const float g_BoundryDurTbl[] =
  54. {
  55. 0.200, // NULL_BOUNDARY = 0, // no boundary
  56. 0.200, // PHRASE_BOUNDARY, // comma
  57. 0.300, // EXCLAM_BOUNDARY, // exclamatory utterance terminator
  58. 0.300, // YN_QUEST_BOUNDARY, // yes-no question terminator
  59. 0.300, // WH_QUEST_BOUNDARY, // wh question terminator
  60. 0.300, // DECLAR_BOUNDARY, // declarative terminator
  61. 0.200, // PAREN_L_BOUNDARY, // left paren
  62. 0.200, // PAREN_R_BOUNDARY, // right paren
  63. 0.200, // QUOTE_L_BOUNDARY, // left quote
  64. 0.200, // QUOTE_R_BOUNDARY, // right quote
  65. 0.100, // PHONE_BOUNDARY, // Telephone number
  66. 0.010, // TOD_BOUNDARY, // Time-of-day
  67. 0.200, // ELLIPSIS_BOUNDARY, // Ellipsis
  68. 0.001, // SUB_BOUNDARY_1, // NOTE: always put these at the end
  69. 0.001, // SUB_BOUNDARY_2,
  70. 0.001, // SUB_BOUNDARY_3,
  71. 0.001, // SUB_BOUNDARY_4,
  72. 0.001, // SUB_BOUNDARY_5,
  73. 0.001, // SUB_BOUNDARY_6,
  74. 0.001, // NUMBER_BOUNDARY,
  75. 0.001, // TAIL_BOUNDARY,
  76. };
  77. //-------------------------------------------
  78. // Translate -24 <--> +24 pitch control to
  79. // 24th root of two pitch scale
  80. //-------------------------------------------
  81. extern const float g_PitchScale[] =
  82. {
  83. 1.0,
  84. 1.0293022366434920287823718007739,
  85. 1.0594630943592952645618252949463,
  86. 1.0905077326652576592070106557607,
  87. 1.1224620483093729814335330496792,
  88. 1.1553526968722730102453370986819,
  89. 1.1892071150027210667174999705605,
  90. 1.2240535433046552391321602168255,
  91. 1.2599210498948731647672106072777,
  92. 1.2968395546510096659337541177919,
  93. 1.3348398541700343648308318811839,
  94. 1.3739536474580891017766557477492,
  95. 1.4142135623730950488016887242091,
  96. 1.4556531828421873543551155614673,
  97. 1.4983070768766814987992807320292,
  98. 1.5422108254079408236122918620901,
  99. 1.5874010519681994747517056392717,
  100. 1.6339154532410998436782440504114,
  101. 1.6817928305074290860622509524658,
  102. 1.7310731220122860533901844375553,
  103. 1.7817974362806786094804524111803,
  104. 1.8340080864093424634870831895876,
  105. 1.8877486253633869932838263133343,
  106. 1.9430638823072117374865788316417,
  107. 2.0
  108. };
  109. //-------------------------------------------
  110. // Translate -10 <--> +10 rate control to
  111. // 10th root of three rate scale
  112. //-------------------------------------------
  113. extern const float g_RateScale[] =
  114. {
  115. 1.0,
  116. 1.1161231740339044344426141383771,
  117. 1.2457309396155173259666803366403,
  118. 1.3903891703159093404852542946161,
  119. 1.5518455739153596742733451355167,
  120. 1.7320508075688772935274463415059,
  121. 1.9331820449317627515248789432662,
  122. 2.1576692799745930995549489159803,
  123. 2.4082246852806920462855086141912,
  124. 2.6878753795222865835819210737269,
  125. 3,
  126. 3.348369522101713303327842415131,
  127. 3.7371928188465519779000410099203,
  128. 4.1711675109477280214557628838472,
  129. 4.6555367217460790228200354065486,
  130. 5.1961524227066318805823390245155,
  131. 5.7995461347952882545746368297956,
  132. 6.4730078399237792986648467479371,
  133. 7.2246740558420761388565258425687,
  134. };
  135. extern const unsigned short g_Opcode_To_ASCII[] =
  136. {
  137. 'IY', 'IH', 'EH', 'AE', 'AA', 'AH', 'AO', 'UH', 'AX', 'ER',
  138. 'EY', 'AY', 'OY', 'AW', 'OW', 'UW',
  139. 'IX', '_', 'w', 'y',
  140. 'r', 'l', 'h', 'm', 'n', 'NG', 'f', 'v', 'TH', 'DH',
  141. 's', 'z', 'SH', 'ZH', 'p', 'b', 't', 'd', 'k', 'g',
  142. 'CH', 'JH', 'DX', '1', '2', '3', '/',
  143. 0x5C, '>', '<', '=', '_', '*', '$', ',', '.', '?',
  144. '!', '-', '#', '+', '~', '@', 0, 0, 0, 0
  145. };
  146. extern const unsigned long g_AlloFlags[] =
  147. {
  148. // IY
  149. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KYGLIDEENDF + KFRONTF,
  150. // IH
  151. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KFRONTF,
  152. // EH
  153. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KFRONTF,
  154. // AE
  155. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KFRONTF,
  156. // AA
  157. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  158. // AH
  159. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  160. // AO
  161. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  162. // UH
  163. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  164. // AX
  165. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  166. // ER
  167. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F,
  168. // EY
  169. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KYGLIDEENDF + KFRONTF + KDIPHTHONGF,
  170. // AY
  171. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KDIPHTHONGF,
  172. // OY
  173. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KDIPHTHONGF,
  174. // AW
  175. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KDIPHTHONGF,
  176. // OW
  177. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KDIPHTHONGF,
  178. // UW
  179. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KDIPHTHONGF,
  180. // IX
  181. KVOWELF + KVOICEDF + KVOWEL1F + KSONORANTF + KSONORANT1F + KFRONTF,
  182. // SIL
  183. KSONORANT1F,
  184. // W
  185. KVOICEDF + KSONORANTF + KSONORANT1F + KCONSONANTF + KLIQGLIDEF + KSONORCONSONF + KLIQGLIDE2F,
  186. // Y
  187. KVOICEDF + KSONORANTF + KSONORANT1F + KCONSONANTF + KLIQGLIDEF + KSONORCONSONF + KYGLIDESTARTF + KYGLIDEENDF,
  188. // R
  189. KVOICEDF + KSONORANTF + KSONORANT1F + KCONSONANTF + KLIQGLIDEF + KSONORCONSONF + KLIQGLIDE2F,
  190. // L
  191. KVOICEDF + KSONORANTF + KSONORANT1F + KCONSONANTF + KLIQGLIDEF + KSONORCONSONF,
  192. // H
  193. KSONORANT1F + KCONSONANTF,
  194. // M
  195. KVOICEDF + KSONORANTF + KSONORANT1F + KNASALF + KCONSONANTF + KSONORCONSONF + KOBSTF + KLABIALF + KHASRELEASEF,
  196. // N
  197. KVOICEDF + KSONORANTF + KSONORANT1F + KNASALF + KCONSONANTF + KSONORCONSONF + KOBSTF + KALVEOLARF + KHASRELEASEF,
  198. // NG
  199. KVOICEDF + KSONORANTF + KSONORANT1F + KNASALF + KCONSONANTF + KSONORCONSONF + KOBSTF + KVELAR + KHASRELEASEF,
  200. // F
  201. KPLOSFRICF + KCONSONANTF + KLABIALF + KFRIC,
  202. // V
  203. KVOICEDF + KPLOSFRICF + KCONSONANTF + KLABIALF + KFRIC,
  204. // TH
  205. KPLOSFRICF + KCONSONANTF + KDENTALF + KFRIC,
  206. // DH
  207. KVOICEDF + KPLOSFRICF + KCONSONANTF + KDENTALF + KFRIC,
  208. // S
  209. KPLOSFRICF + KCONSONANTF + KALVEOLARF + KFRIC,
  210. // Z
  211. KVOICEDF + KPLOSFRICF + KCONSONANTF + KALVEOLARF + KFRIC,
  212. // SH
  213. KPLOSFRICF + KCONSONANTF + KPALATALF + KFRIC,
  214. // ZH
  215. KVOICEDF + KPLOSFRICF + KCONSONANTF + KPALATALF + KFRIC,
  216. // P
  217. KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KLABIALF + KHASRELEASEF,
  218. // B
  219. KVOICEDF + KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KLABIALF + KHASRELEASEF,
  220. // T
  221. KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KALVEOLARF + KHASRELEASEF,
  222. // D
  223. KVOICEDF + KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KALVEOLARF + KHASRELEASEF,
  224. // K
  225. KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KVELAR + KHASRELEASEF,
  226. // G
  227. KVOICEDF + KPLOSFRICF + KSTOPF + KCONSONANTF + KPLOSIVEF + KOBSTF + KVELAR + KHASRELEASEF,
  228. // CH
  229. KPLOSFRICF + KCONSONANTF + KPLOSIVEF + KOBSTF + KPALATALF + KAFFRICATEF,
  230. // JH
  231. KVOICEDF + KPLOSFRICF + KCONSONANTF + KPLOSIVEF + KOBSTF + KPALATALF + KAFFRICATEF,
  232. // DX
  233. KVOICEDF + KPLOSFRICF + KCONSONANTF + KOBSTF,
  234. };
  235. extern const short g_IPAToAllo[] =
  236. {
  237. 28, // _IY_
  238. 27, // _IH_
  239. 21, // _EH_
  240. 11, // _AE_
  241. 10, // _AA_
  242. 12, // _AH_
  243. 13, // _AO_
  244. 43, // _UH_
  245. 15, // _AX_
  246. 22, // _ER_
  247. 23, // _EY_
  248. 16, // _AY_
  249. 36, // _OY_
  250. 14, // _AW_
  251. 35, // _OW_
  252. 44, // _UW_
  253. NO_IPA, // _IX_
  254. 7, // _SIL_
  255. 46, // _w_
  256. 47, // _y_
  257. 38, // _r_ 0x279
  258. 31, // _l_
  259. 26, // _h_ 0x68
  260. 32, // _m_
  261. 33, // _n_
  262. 34, // _NG_
  263. 24, // _f_
  264. 45, // _v_
  265. 42, // _TH_
  266. 20, // _DH_
  267. 39, // _s_
  268. 48, // _z_
  269. 40, // _SH_
  270. 49, // _ZH_
  271. 37, // _p_
  272. 17, // _b_
  273. 41, // _t_
  274. 19, // _d_
  275. 30, // _k_
  276. 25, // _g_ 0x67
  277. 18, // _CH_
  278. 29, // _JH_ 0x2a4
  279. NO_IPA, // _DX_ // @@@@
  280. 8, // _STRESS1_
  281. 9, // _STRESS2_
  282. NO_IPA, // _EMPHSTRESS_
  283. 1, // _SYLLABLE_
  284. };
  285. extern const short g_AlloToViseme[] =
  286. {
  287. SP_VISEME_6, // _IY_
  288. SP_VISEME_6, // _IH_
  289. SP_VISEME_4, // _EH_
  290. SP_VISEME_1, // _AE_
  291. SP_VISEME_2, // _AA_
  292. SP_VISEME_1, // _AH_
  293. SP_VISEME_3, // _AO_
  294. SP_VISEME_4, // _UH_
  295. SP_VISEME_1, // _AX_
  296. SP_VISEME_5, // _ER_
  297. SP_VISEME_4, // _EY_
  298. SP_VISEME_11, // _AY_
  299. SP_VISEME_10, // _OY_
  300. SP_VISEME_9, // _AW_
  301. SP_VISEME_8, // _OW_
  302. SP_VISEME_7, // _UW_
  303. SP_VISEME_6, // _IX_
  304. SP_VISEME_0, // _SIL_
  305. SP_VISEME_7, // _w_
  306. SP_VISEME_6, // _y_
  307. SP_VISEME_13, // _r_
  308. SP_VISEME_14, // _l_
  309. SP_VISEME_12, // _h_
  310. SP_VISEME_21, // _m_
  311. SP_VISEME_19, // _n_
  312. SP_VISEME_20, // _NG_
  313. SP_VISEME_18, // _f_
  314. SP_VISEME_18, // _v_
  315. SP_VISEME_17, // _TH_
  316. SP_VISEME_17, // _DH_
  317. SP_VISEME_15, // _s_
  318. SP_VISEME_15, // _z_
  319. SP_VISEME_16, // _SH_
  320. SP_VISEME_16, // _ZH_
  321. SP_VISEME_21, // _p_
  322. SP_VISEME_21, // _b_
  323. SP_VISEME_19, // _t_
  324. SP_VISEME_19, // _d_
  325. SP_VISEME_20, // _k_
  326. SP_VISEME_20, // _g_
  327. SP_VISEME_16, // _CH_
  328. SP_VISEME_16, // _JH_
  329. SP_VISEME_13, // _DX_ // @@@@
  330. };