cst_clunits.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*************************************************************************/
  2. /* */
  3. /* Language Technologies Institute */
  4. /* Carnegie Mellon University */
  5. /* Copyright (c) 2000 */
  6. /* All Rights Reserved. */
  7. /* */
  8. /* Permission is hereby granted, free of charge, to use and distribute */
  9. /* this software and its documentation without restriction, including */
  10. /* without limitation the rights to use, copy, modify, merge, publish, */
  11. /* distribute, sublicense, and/or sell copies of this work, and to */
  12. /* permit persons to whom this work is furnished to do so, subject to */
  13. /* the following conditions: */
  14. /* 1. The code must retain the above copyright notice, this list of */
  15. /* conditions and the following disclaimer. */
  16. /* 2. Any modifications must be clearly marked as such. */
  17. /* 3. Original authors' names are not deleted. */
  18. /* 4. The authors' names are not used to endorse or promote products */
  19. /* derived from this software without specific prior written */
  20. /* permission. */
  21. /* */
  22. /* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
  23. /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
  24. /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
  25. /* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
  26. /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
  27. /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
  28. /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
  29. /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
  30. /* THIS SOFTWARE. */
  31. /* */
  32. /*************************************************************************/
  33. /* Author: Alan W Black (awb@cs.cmu.edu) */
  34. /* Date: April 2001 */
  35. /*************************************************************************/
  36. /* */
  37. /* clunits db */
  38. /* */
  39. /*************************************************************************/
  40. #ifndef _CST_CLUNITS_H__
  41. #define _CST_CLUNITS_H__
  42. #include "cst_wave.h"
  43. #include "cst_cart.h"
  44. #include "cst_viterbi.h"
  45. #include "cst_track.h"
  46. #include "cst_sts.h"
  47. #define CLUNIT_NONE (unsigned short)65535
  48. typedef struct cst_clunit_struct {
  49. unsigned short type, phone;
  50. int start, end;
  51. int prev, next;
  52. } cst_clunit;
  53. typedef struct cst_clunit_type_struct {
  54. const char *name;
  55. int start, count;
  56. } cst_clunit_type;
  57. typedef struct cst_clunit_db_struct {
  58. const char *name;
  59. const cst_clunit_type *types;
  60. const cst_cart * const *trees;
  61. const cst_clunit *units;
  62. int num_types, num_units;
  63. /* These may be set up at runtime (in file-mapped databases) */
  64. cst_sts_list *sts, *mcep;
  65. /* These are pre-scaled by 65536 to accomodate fixed-point machines */
  66. const int *join_weights;
  67. /* Misc. important parameters */
  68. int optimal_coupling;
  69. int extend_selections;
  70. int f0_weight;
  71. char *(*unit_name_func)(cst_item *s);
  72. } cst_clunit_db;
  73. CST_VAL_USER_TYPE_DCLS(clunit_db,cst_clunit_db)
  74. CST_VAL_USER_TYPE_DCLS(vit_cand,cst_vit_cand)
  75. cst_utterance *clunits_synth(cst_utterance *utt);
  76. cst_utterance *clunits_dump_units(cst_utterance *utt);
  77. char *clunits_ldom_phone_word(cst_item *s);
  78. int clunit_get_unit_index(cst_clunit_db *cludb,
  79. const char *unit_type,
  80. int instance);
  81. int clunit_get_unit_index_name(cst_clunit_db *cludb,
  82. const char *name);
  83. /* Used to test if the unit name is in the database, -1 if not */
  84. int clunit_get_unit_type_index(cst_clunit_db *cludb, const char *name);
  85. #define UNIT_TYPE(db,u) ((db)->types[(db)->units[(u)].type].name)
  86. #define UNIT_INDEX(db,u) ((u) - (db)->types[(db)->units[(u)].type].start)
  87. #endif