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.

824 lines
24 KiB

  1. /*******************************************************************************
  2. * AlloOps.cpp *
  3. *-------------*
  4. * Description:
  5. * This module is the implementation file for the CAlloOps class.
  6. *-------------------------------------------------------------------------------
  7. * Created By: mc Date: 03/12/99
  8. * Copyright (C) 1999 Microsoft Corporation
  9. * All Rights Reserved
  10. *
  11. *******************************************************************************/
  12. //--- Additional includes
  13. #include "stdafx.h"
  14. #ifndef __spttseng_h__
  15. #include "spttseng.h"
  16. #endif
  17. #ifndef SPDebug_h
  18. #include <spdebug.h>
  19. #endif
  20. #ifndef FeedChain_H
  21. #include "FeedChain.h"
  22. #endif
  23. #ifndef Frontend_H
  24. #include "Frontend.h"
  25. #endif
  26. #ifndef AlloOps_H
  27. #include "AlloOps.h"
  28. #endif
  29. //-----------------------------
  30. // Data.cpp
  31. //-----------------------------
  32. extern const unsigned short g_Opcode_To_ASCII[];
  33. extern const unsigned long g_AlloFlags[];
  34. /*****************************************************************************
  35. * CBookmarkList::~CBookmarkList *
  36. *-------------------------------*
  37. * Description:
  38. * Destructor for CBookmarkList
  39. *
  40. ********************************************************************** MC ***/
  41. CBookmarkList::~CBookmarkList()
  42. {
  43. SPDBG_FUNC( "CBookmarkList::~CBookmarkList" );
  44. BOOKMARK_ITEM* pItem;
  45. //----------------------------------------
  46. // Remove every item in link list.
  47. //----------------------------------------
  48. while( !m_BMList.IsEmpty() )
  49. {
  50. pItem = (BOOKMARK_ITEM*)m_BMList.RemoveHead();
  51. delete pItem;
  52. }
  53. } /* CBookmarkList::~CBookmarkList */
  54. /*****************************************************************************
  55. * CFEToken::CFEToken *
  56. *------------------------*
  57. * Description:
  58. * Initializer for CFEToken
  59. *
  60. ********************************************************************** MC ***/
  61. CFEToken::CFEToken()
  62. {
  63. SPDBG_FUNC( "CFEToken::CFEToken" );
  64. user_Volume = DEFAULT_USER_VOL;
  65. user_Rate = DEFAULT_USER_RATE;
  66. user_Pitch = DEFAULT_USER_PITCH;
  67. user_Emph = DEFAULT_USER_EMPH;
  68. user_Break = 0;
  69. pBMObj = NULL;
  70. memset( &tokStr[0], 0, sizeof(WCHAR) * TOKEN_LEN_MAX);
  71. tokLen = 0;
  72. memset( &phon_Str[0], 0, sizeof(short) * SP_MAX_PRON_LENGTH);
  73. phon_Len = 0;
  74. m_posClass = POS_UNK;
  75. POScode = MS_Unknown;
  76. m_TuneBoundaryType = NULL_BOUNDARY;
  77. m_Accent = K_NOACC;
  78. m_Boundary = K_NOBND;
  79. m_TermSil = 0;
  80. m_DurScale = 0.0f;
  81. m_ProsodyDurScale = 1.0f;
  82. m_PitchBaseOffs = 0.0f;
  83. m_PitchRangeScale = 1.0f;
  84. // The following don't need to be init'd
  85. m_PronType = PRON_LTS;
  86. sentencePosition = 0; // Source sentence position for this token
  87. sentenceLen = 0; // Source sentence length for this token
  88. srcPosition = 0; // Source position for this token
  89. srcLen = 0; // Source length for this token
  90. m_Accent_Prom = 0; // prominence prosodic control
  91. m_Boundary_Prom = 0; // prominence prosodic control
  92. m_TermSil = 0; // Pad word with silence (in sec)
  93. //--- Diagnostic
  94. m_AccentSource = ACC_NoSource;
  95. m_BoundarySource = BND_NoSource;
  96. m_SilenceSource = SIL_NoSource;
  97. } /* CFEToken::CFEToken */
  98. /*****************************************************************************
  99. * CFEToken::~CFEToken *
  100. *-----------------------*
  101. * Description:
  102. * Destructor for CFEToken
  103. *
  104. ********************************************************************** MC ***/
  105. CFEToken::~CFEToken()
  106. {
  107. SPDBG_FUNC( "CFEToken::~CFEToken" );
  108. if( pBMObj != NULL )
  109. {
  110. //---------------------------------------
  111. // Dispose bookmark list
  112. //---------------------------------------
  113. delete pBMObj;
  114. }
  115. } /* CFEToken::~CFEToken */
  116. /*****************************************************************************
  117. * CAlloCell::CAlloCell *
  118. *------------------------*
  119. * Description:
  120. * Initializer for CAlloCell
  121. *
  122. ********************************************************************** MC ***/
  123. CAlloCell::CAlloCell()
  124. {
  125. SPDBG_FUNC( "CAlloCell::CAlloCell" );
  126. long i;
  127. m_allo = _SIL_;
  128. m_dur = 0;
  129. m_ftDuration = m_UnitDur = 0;
  130. m_knots = KNOTS_PER_PHON;
  131. m_ctrlFlags = 0;
  132. m_user_Rate = 0;
  133. m_user_Volume = DEFAULT_USER_VOL;
  134. m_user_Pitch = 0;
  135. m_user_Emph = 0;
  136. m_user_Break = 0;
  137. m_Sil_Break = 0;
  138. m_Pitch_HI = 0;
  139. m_Pitch_LO = 0;
  140. m_pBMObj = NULL;
  141. m_ToBI_Boundary = K_NOBND;
  142. m_ToBI_Accent = K_NOACC;
  143. m_TuneBoundaryType = m_NextTuneBoundaryType = NULL_BOUNDARY;
  144. m_DurScale = 1.0;
  145. m_ProsodyDurScale = 1.0;
  146. m_PitchBaseOffs = 0.0f;
  147. m_PitchRangeScale = 1.0f;
  148. for( i = 0; i < KNOTS_PER_PHON; i++ )
  149. {
  150. m_ftTime[i] = 0;
  151. m_ftPitch[i] = 100;
  152. }
  153. m_Accent_Prom = 0; // prominence prosodic control
  154. m_Boundary_Prom = 0; // prominence prosodic control
  155. m_PitchBufStart = 0;
  156. m_PitchBufEnd = 0;
  157. m_SrcPosition = 0;
  158. m_SrcLen = 0;
  159. m_SentencePosition = 0;
  160. m_SentenceLen = 0;
  161. //--- Diagnostic
  162. m_AccentSource = ACC_NoSource;
  163. m_BoundarySource = BND_NoSource;
  164. m_SilenceSource = SIL_NoSource;
  165. m_pTextStr = NULL;
  166. } /* CAlloCell::CAlloCell */
  167. /*****************************************************************************
  168. * CAlloCell::~CAlloCell *
  169. *-----------------------*
  170. * Description:
  171. * Destructor for CAlloCell
  172. *
  173. ********************************************************************** MC ***/
  174. CAlloCell::~CAlloCell()
  175. {
  176. SPDBG_FUNC( "CAlloCell::~CAlloCell" );
  177. if( m_pBMObj != NULL )
  178. {
  179. //---------------------------------------
  180. // Dispose bookmark list
  181. //---------------------------------------
  182. delete m_pBMObj;
  183. }
  184. if( m_pTextStr != NULL )
  185. {
  186. //---------------------------------------
  187. // Dispose bookmark list
  188. //---------------------------------------
  189. delete m_pTextStr;
  190. }
  191. } /* CAlloCell::~CAlloCell */
  192. /*****************************************************************************
  193. * CAlloList::CAlloList *
  194. *------------------------*
  195. * Description:
  196. * Initialize list with 2 silence entries. These will
  197. * become the head an tail when real entries are stuffed
  198. *
  199. ********************************************************************** MC ***/
  200. CAlloList::CAlloList()
  201. {
  202. SPDBG_FUNC( "CAlloList::CAlloList" );
  203. CAlloCell *pCell;
  204. m_cAllos = 0;
  205. m_ListPos = NULL;
  206. //------------------------------------
  207. // Create initial TAIL silence cell
  208. //------------------------------------
  209. pCell = new CAlloCell;
  210. if( pCell )
  211. {
  212. m_AlloCellList.AddHead( pCell );
  213. pCell->m_ctrlFlags |= WORD_START + TERM_BOUND;
  214. pCell->m_TuneBoundaryType = TAIL_BOUNDARY;
  215. pCell->m_SilenceSource = SIL_Tail;
  216. m_cAllos++;
  217. }
  218. //------------------------------------
  219. // Create initial HEAD silence cell
  220. //------------------------------------
  221. pCell = new CAlloCell;
  222. if( pCell )
  223. {
  224. m_AlloCellList.AddHead( pCell );
  225. pCell->m_ctrlFlags |= WORD_START;
  226. pCell->m_SilenceSource = SIL_Head;
  227. m_cAllos++;
  228. }
  229. } /* CAlloList::CAlloList */
  230. /*****************************************************************************
  231. * CAlloList::~CAlloList *
  232. *-------------------------*
  233. * Description:
  234. * Remove every item in link list.
  235. *
  236. ********************************************************************** MC ***/
  237. CAlloList::~CAlloList()
  238. {
  239. SPDBG_FUNC( "CAlloList::~CAlloList" );
  240. CAlloCell *pCell;
  241. while( !m_AlloCellList.IsEmpty() )
  242. {
  243. pCell = (CAlloCell*)m_AlloCellList.RemoveHead();
  244. delete pCell;
  245. }
  246. } /* CAlloList::~CAlloList */
  247. /*****************************************************************************
  248. * CAlloList::GetAllo *
  249. *---------------------*
  250. * Description:
  251. * Return pointer of allocell at index
  252. *
  253. ********************************************************************** MC ***/
  254. CAlloCell *CAlloList::GetCell( long index )
  255. {
  256. SPDBG_FUNC( "CAlloList::GetCell" );
  257. return (CAlloCell*)m_AlloCellList.GetAt( m_AlloCellList.FindIndex( index ));
  258. } /* CAlloList::GetCell */
  259. /*****************************************************************************
  260. * CAlloList::GetTailCell *
  261. *-------------------------*
  262. * Description:
  263. * Return pointer of last allo in link list
  264. *
  265. ********************************************************************** MC ***/
  266. CAlloCell *CAlloList::GetTailCell()
  267. {
  268. SPDBG_FUNC( "CAlloList::GetTailCell" );
  269. return (CAlloCell*)m_AlloCellList.GetTail();
  270. } /* CAlloList::GetTailCell */
  271. /*****************************************************************************
  272. * CAlloList::GetTailCell *
  273. *-----------------------*
  274. * Description:
  275. * Return allo list size
  276. *
  277. ********************************************************************** MC ***/
  278. long CAlloList::GetCount()
  279. {
  280. SPDBG_FUNC( "CAlloList::GetCount" );
  281. return m_AlloCellList.GetCount();
  282. } /* CAlloList::GetCount */
  283. /*****************************************************************************
  284. * PrintPhon *
  285. *-----------*
  286. * Description:
  287. * Print 2-char allo name
  288. *
  289. ********************************************************************** MC ***/
  290. void PrintPhon( ALLO_CODE allo, char * /*msgStr*/)
  291. {
  292. SPDBG_FUNC( "PrintPhon" );
  293. unsigned short nChar;
  294. nChar = g_Opcode_To_ASCII[allo];
  295. if( nChar >> 8 )
  296. {
  297. SPDBG_DMSG1( "%c", nChar >> 8 );
  298. }
  299. if( nChar & 0xFF )
  300. {
  301. SPDBG_DMSG1( "%c", nChar & 0xFF );
  302. }
  303. } /* PrintPhon */
  304. /*****************************************************************************
  305. * CAlloList::OutAllos *
  306. *--------------------*
  307. * Description:
  308. * Dump ALLO_CELL contents
  309. *
  310. ********************************************************************** MC ***/
  311. void CAlloList::OutAllos()
  312. {
  313. SPDBG_FUNC( "CAlloOps::OutAllos" );
  314. CAlloCell *pCurCell;
  315. long i, flags, flagsT;
  316. char msgStr[400];
  317. for( i = 0; i < m_cAllos; i++ )
  318. {
  319. pCurCell = GetCell( i );
  320. flags = pCurCell->m_ctrlFlags;
  321. if( flags & WORD_START)
  322. {
  323. SPDBG_DMSG0( "\n" );
  324. }
  325. //----------------------------
  326. // Allo
  327. //----------------------------
  328. PrintPhon( pCurCell->m_allo, msgStr );
  329. //----------------------------
  330. // Duration
  331. //----------------------------
  332. SPDBG_DMSG1( "\t%.3f\t", pCurCell->m_ftDuration );
  333. //----------------------------
  334. // Boundry
  335. //----------------------------
  336. if( flags & BOUNDARY_TYPE_FIELD)
  337. {
  338. SPDBG_DMSG0( "(" );
  339. if( flags & WORD_START)
  340. {
  341. SPDBG_DMSG0( "-wS" );
  342. }
  343. if( flags & TERM_BOUND)
  344. {
  345. SPDBG_DMSG0( "-tB" );
  346. }
  347. SPDBG_DMSG0( ")\t" );
  348. }
  349. //----------------------------
  350. // Syllable type
  351. //----------------------------
  352. if( flags & SYLLABLE_TYPE_FIELD)
  353. {
  354. SPDBG_DMSG0( "(" );
  355. if( flags & WORD_END_SYLL)
  356. {
  357. SPDBG_DMSG0( "-wE" );
  358. }
  359. if( flags & TERM_END_SYLL)
  360. {
  361. SPDBG_DMSG0( "-tE" );
  362. }
  363. SPDBG_DMSG0( ")\t" );
  364. }
  365. //----------------------------
  366. // Syllable order
  367. //----------------------------
  368. if( flags & SYLLABLE_ORDER_FIELD)
  369. {
  370. SPDBG_DMSG0( "(" );
  371. flagsT = flags & SYLLABLE_ORDER_FIELD;
  372. if( flagsT == FIRST_SYLLABLE_IN_WORD)
  373. {
  374. SPDBG_DMSG0( "-Fs" );
  375. }
  376. else if( flagsT == MID_SYLLABLE_IN_WORD)
  377. {
  378. SPDBG_DMSG0( "-Ms" );
  379. }
  380. else if( flagsT == LAST_SYLLABLE_IN_WORD)
  381. {
  382. SPDBG_DMSG0( "-Ls" );
  383. }
  384. SPDBG_DMSG0( ")\t" );
  385. }
  386. //----------------------------
  387. // Stress
  388. //----------------------------
  389. if( flags & PRIMARY_STRESS)
  390. {
  391. SPDBG_DMSG0( "-Stress\t" );
  392. }
  393. //----------------------------
  394. // Word initial consonant
  395. //----------------------------
  396. if( flags & WORD_INITIAL_CONSONANT)
  397. {
  398. SPDBG_DMSG0( "-InitialK\t" );
  399. }
  400. //----------------------------
  401. // Syllable start
  402. //----------------------------
  403. if( flags & SYLLABLE_START)
  404. {
  405. SPDBG_DMSG0( "-Syll\t" );
  406. }
  407. SPDBG_DMSG0( "\n" );
  408. }
  409. } /* CAlloList::OutAllos */
  410. /*****************************************************************************
  411. * CAlloList::WordToAllo *
  412. *-----------------------*
  413. * Description:
  414. * Copy word token to AlloCells
  415. * Insert allos BEFORE 'pEndCell'
  416. *
  417. ********************************************************************** MC ***/
  418. bool CAlloList::WordToAllo( CFEToken *pPrevTok, CFEToken *pTok, CFEToken *pNextTok, CAlloCell *pEndCell )
  419. {
  420. SPDBG_FUNC( "CAlloList::WordToAllo" );
  421. long i;
  422. long startLatch;
  423. CAlloCell *pCurCell;
  424. long firstVowel, lastVoiced;
  425. bool gotAccent, isStressed;
  426. bool hasSpeech;
  427. //-----------------------------------------
  428. // First, find ToBI accent locations
  429. //-----------------------------------------
  430. firstVowel = lastVoiced = (-1);
  431. gotAccent = false;
  432. hasSpeech = false;
  433. for( i = 0; i < pTok->phon_Len; i++ )
  434. {
  435. isStressed = false;
  436. if( pTok->phon_Str[i] < _STRESS1_ )
  437. {
  438. //----------------------------
  439. // Potential ToBI accent
  440. //----------------------------
  441. if( (!gotAccent) && (g_AlloFlags[pTok->phon_Str[i]] & KVOWELF) )
  442. {
  443. if( (i < (pTok->phon_Len -1)) && (pTok->phon_Str[i+1] == _STRESS1_) )
  444. {
  445. //-------------------------------------
  446. // Put accent at 1st stressed vowel
  447. //-------------------------------------
  448. firstVowel = i;
  449. gotAccent = true;
  450. }
  451. else if( firstVowel < 0 )
  452. {
  453. //-------------------------------------
  454. // In case there's no stressed vowel
  455. // in this word, use 1st vowel
  456. //-------------------------------------
  457. firstVowel = i;
  458. }
  459. }
  460. //----------------------------
  461. // Potential ToBI boundary
  462. //----------------------------
  463. if( g_AlloFlags[pTok->phon_Str[i]] & KVOICEDF )
  464. {
  465. lastVoiced = i;
  466. }
  467. }
  468. }
  469. //-----------------------------------------
  470. // Now, copy data to allo list
  471. //-----------------------------------------
  472. startLatch = true;
  473. for( i = 0; i < pTok->phon_Len; i++ )
  474. {
  475. if( pTok->phon_Str[i] < _STRESS1_ )
  476. {
  477. if( (pTok->phon_Str[i] == _SIL_) && (pTok->m_TuneBoundaryType >= SUB_BOUNDARY_1) )
  478. {
  479. //----------------------------------------------------------------
  480. // Before skipping this, propagate the dur scale gain
  481. //----------------------------------------------------------------
  482. if( pTok->m_DurScale == 0 )
  483. {
  484. if( pPrevTok )
  485. {
  486. pTok->m_DurScale = pPrevTok->m_DurScale;
  487. }
  488. else
  489. {
  490. pTok->m_DurScale = 1.0;
  491. }
  492. }
  493. continue;
  494. }
  495. //------------------------------------
  496. // Create new cell
  497. //------------------------------------
  498. pCurCell = new CAlloCell;
  499. if( pCurCell )
  500. {
  501. m_AlloCellList.InsertBefore( m_AlloCellList.Find(pEndCell), pCurCell);
  502. m_cAllos++;
  503. //----------------------------
  504. // Copy only phons
  505. //----------------------------
  506. pCurCell->m_allo = (ALLO_CODE) pTok->phon_Str[i];
  507. //---------------------------------------------
  508. // See if this allo will generate speech
  509. //---------------------------------------------
  510. if( (pCurCell->m_allo >= _IY_) &&
  511. (pCurCell->m_allo <= _DX_) &&
  512. (pCurCell->m_allo != _SIL_) )
  513. {
  514. hasSpeech = true;
  515. }
  516. //----------------------------
  517. // Save src position
  518. //----------------------------
  519. pCurCell->m_SrcPosition = pTok->srcPosition;
  520. pCurCell->m_SrcLen = pTok->srcLen;
  521. pCurCell->m_SentencePosition = pTok->sentencePosition;
  522. pCurCell->m_SentenceLen = pTok->sentenceLen;
  523. //----------------------------
  524. // Flag WORD START?
  525. //----------------------------
  526. if( startLatch )
  527. {
  528. pCurCell->m_ctrlFlags |= WORD_START;
  529. startLatch = false;
  530. }
  531. //----------------------------
  532. // Is next allo a STRESS?
  533. //----------------------------
  534. if( i < (pTok->phon_Len -1) )
  535. {
  536. if( pTok->phon_Str[i+1] == _STRESS1_ )
  537. {
  538. pCurCell->m_ctrlFlags |= PRIMARY_STRESS;
  539. }
  540. else
  541. {
  542. //----------------------------------------------
  543. // Voice inventory does not have unstressed
  544. // entries for these diphongs
  545. //----------------------------------------------
  546. if( (pCurCell->m_allo == _AW_) ||
  547. (pCurCell->m_allo == _AY_) ||
  548. (pCurCell->m_allo == _EY_) ||
  549. (pCurCell->m_allo == _OY_) )
  550. {
  551. pCurCell->m_ctrlFlags |= PRIMARY_STRESS;
  552. }
  553. }
  554. }
  555. //---------------------------
  556. // Diagnostic
  557. //---------------------------
  558. if( pCurCell->m_allo == _SIL_ )
  559. {
  560. pCurCell->m_SilenceSource = pTok->m_SilenceSource;
  561. }
  562. //----------------------------
  563. // Place ToBI accent
  564. //----------------------------
  565. if( i == firstVowel )
  566. {
  567. pCurCell->m_ToBI_Accent = pTok->m_Accent;
  568. //---------------------------
  569. // Diagnostic
  570. //---------------------------
  571. pCurCell->m_AccentSource = pTok->m_AccentSource;
  572. pCurCell->m_pTextStr = new char[pTok->tokLen+1];
  573. if( pCurCell->m_pTextStr )
  574. {
  575. WideCharToMultiByte ( CP_ACP, 0,
  576. pTok->tokStr, -1,
  577. pCurCell->m_pTextStr, pTok->tokLen+1,
  578. NULL, NULL);
  579. }
  580. }
  581. pCurCell->m_Accent_Prom = pTok->m_Accent_Prom;
  582. //----------------------------
  583. // Place ToBI boundary
  584. //----------------------------
  585. if( i == lastVoiced )
  586. {
  587. pCurCell->m_ToBI_Boundary = pTok->m_Boundary;
  588. //---------------------------
  589. // Diagnostic
  590. //---------------------------
  591. pCurCell->m_BoundarySource = pTok->m_BoundarySource;
  592. }
  593. pCurCell->m_Boundary_Prom = pTok->m_Boundary_Prom;
  594. //----------------------------
  595. // User Controls
  596. //----------------------------
  597. pCurCell->m_user_Volume = pTok->user_Volume;
  598. pCurCell->m_user_Rate = pTok->user_Rate;
  599. pCurCell->m_user_Pitch = pTok->user_Pitch;
  600. pCurCell->m_user_Emph = 0;
  601. if( pTok->user_Emph > 0 )
  602. {
  603. if( i == firstVowel )
  604. {
  605. pCurCell->m_user_Emph = pTok->user_Emph;
  606. pCurCell->m_ctrlFlags |= PRIMARY_STRESS;
  607. }
  608. }
  609. pCurCell->m_user_Break = pTok->user_Break;
  610. pCurCell->m_pBMObj = pTok->pBMObj;
  611. pTok->pBMObj = NULL;
  612. //-----------------------------------------------
  613. // If token's m_DurScale is not defined,
  614. // try to use prev token's ratio
  615. //-----------------------------------------------
  616. if( pTok->m_DurScale == 0 )
  617. {
  618. if( pPrevTok )
  619. {
  620. pCurCell->m_DurScale = pPrevTok->m_DurScale;
  621. }
  622. else
  623. {
  624. pCurCell->m_DurScale = 1.0;
  625. }
  626. //-------------------------------------------------------
  627. // Write back in case next token is also undefined
  628. //-------------------------------------------------------
  629. pTok->m_DurScale = pCurCell->m_DurScale;
  630. }
  631. else
  632. {
  633. pCurCell->m_DurScale = pTok->m_DurScale;
  634. }
  635. pCurCell->m_ProsodyDurScale = pTok->m_ProsodyDurScale;
  636. if( pNextTok )
  637. {
  638. pCurCell->m_NextTuneBoundaryType = pNextTok->m_TuneBoundaryType;
  639. }
  640. else
  641. {
  642. pCurCell->m_NextTuneBoundaryType = NULL_BOUNDARY;
  643. }
  644. pCurCell->m_PitchBaseOffs = pTok->m_PitchBaseOffs;
  645. pCurCell->m_PitchRangeScale = pTok->m_PitchRangeScale;
  646. //----------------------------------------------
  647. // Is this a term word?
  648. //----------------------------------------------
  649. pCurCell->m_TuneBoundaryType = pTok->m_TuneBoundaryType;
  650. if( pTok->m_TuneBoundaryType != NULL_BOUNDARY )
  651. {
  652. pCurCell->m_ctrlFlags |= TERM_BOUND + WORD_START;
  653. }
  654. }
  655. }
  656. }
  657. //----------------------------------------
  658. // Insert word pause?
  659. //----------------------------------------
  660. if( pTok->m_TermSil > 0 )
  661. {
  662. pCurCell = new CAlloCell;
  663. if( pCurCell )
  664. {
  665. m_AlloCellList.InsertBefore( m_AlloCellList.Find(pEndCell), pCurCell);
  666. m_cAllos++;
  667. //----------------------------
  668. // Add silence
  669. //----------------------------
  670. pCurCell->m_allo = _SIL_;
  671. //----------------------------
  672. // Save src position
  673. //----------------------------
  674. pCurCell->m_SrcPosition = pTok->srcPosition;
  675. pCurCell->m_SrcLen = pTok->srcLen;
  676. pCurCell->m_SentencePosition = pTok->sentencePosition;
  677. pCurCell->m_SentenceLen = pTok->sentenceLen;
  678. //----------------------------
  679. // User Controls
  680. //----------------------------
  681. pCurCell->m_user_Volume = pTok->user_Volume;
  682. pCurCell->m_user_Rate = pTok->user_Rate;
  683. pCurCell->m_user_Pitch = pTok->user_Pitch;
  684. pCurCell->m_user_Emph = pTok->user_Emph;
  685. pCurCell->m_user_Break = pTok->user_Break;
  686. pCurCell->m_pBMObj = NULL;
  687. pCurCell->m_TuneBoundaryType = pTok->m_TuneBoundaryType;
  688. pCurCell->m_Boundary_Prom = pTok->m_Boundary_Prom;
  689. pCurCell->m_Accent_Prom = pTok->m_Accent_Prom;
  690. pCurCell->m_ctrlFlags = 0;
  691. pCurCell->m_UnitDur = pTok->m_TermSil;
  692. pCurCell->m_Sil_Break = (unsigned long)(pCurCell->m_UnitDur * 1000); // sec -> ms
  693. pCurCell->m_user_Break = 0;
  694. pCurCell->m_DurScale = pTok->m_DurScale;
  695. pCurCell->m_ProsodyDurScale = 1.0f;
  696. }
  697. }
  698. return hasSpeech;
  699. } /* CAlloList::WordToAllo */