1 /*************************************************************************/ 2 /* */ 3 /* Carnegie Mellon University and */ 4 /* Centre for Speech Technology Research */ 5 /* University of Edinburgh, UK */ 6 /* Copyright (c) 1998-2000 */ 7 /* All Rights Reserved. */ 8 /* */ 9 /* Permission is hereby granted, free of charge, to use and distribute */ 10 /* this software and its documentation without restriction, including */ 11 /* without limitation the rights to use, copy, modify, merge, publish, */ 12 /* distribute, sublicense, and/or sell copies of this work, and to */ 13 /* permit persons to whom this work is furnished to do so, subject to */ 14 /* the following conditions: */ 15 /* 1. The code must retain the above copyright notice, this list of */ 16 /* conditions and the following disclaimer. */ 17 /* 2. Any modifications must be clearly marked as such. */ 18 /* 3. Original authors' names are not deleted. */ 19 /* 4. The authors' names are not used to endorse or promote products */ 20 /* derived from this software without specific prior written */ 21 /* permission. */ 22 /* */ 23 /* THE UNIVERSITY OF EDINBURGH, CARNEGIE MELLON UNIVERSITY AND THE */ 24 /* CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO */ 25 /* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY */ 26 /* AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF EDINBURGH, CARNEGIE */ 27 /* MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, */ 28 /* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER */ 29 /* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION */ 30 /* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF */ 31 /* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ 32 /* */ 33 /*************************************************************************/ 34 35 #ifndef __CLUNITS_H__ 36 #define __CLUNITS_H__ 37 38 #include "EST_StringTrie.h" 39 40 class CLunit { 41 public: 42 CLunit(); 43 ~CLunit(); 44 45 EST_String fileid; 46 EST_String name; 47 EST_String base_name; 48 float start; 49 float mid; 50 float end; 51 class CLunit *prev_unit; 52 class CLunit *next_unit; 53 int samp_start; 54 int samp_end; 55 int middle_frame; 56 EST_Track *join_coeffs; 57 EST_Track *coefs; 58 EST_Wave *sig; 59 }; 60 61 class CLfile { 62 public: 63 CLfile(); 64 ~CLfile(); 65 66 EST_Track *join_coeffs; 67 EST_Track *coefs; 68 EST_Wave *sig; 69 }; 70 71 class CLDB { 72 public: 73 CLDB(); 74 ~CLDB(); 75 76 LISP params; 77 EST_StringTrie index; 78 EST_StringTrie fileindex; 79 EST_FVector cweights; 80 get_unit(const EST_String & name)81 CLunit *get_unit(const EST_String &name) 82 { return (CLunit *)index.lookup(name); } get_fileitem(const EST_String & name)83 CLfile *get_fileitem(const EST_String &name) 84 { return (CLfile *)fileindex.lookup(name); } 85 void load_coefs_sig(EST_Item *unit); 86 CLfile *get_file_coefs_sig(const EST_String &fileid); 87 void load_join_coefs(CLunit *unit); 88 CLfile *get_file_join_coefs(const EST_String &fileid); 89 }; 90 91 92 LISP cl_load_db(LISP params); 93 LISP acost_utt_load_coeffs(LISP utt, LISP params); 94 LISP make_unit_distance_tables(LISP unittypes, LISP params); 95 LISP ac_distance_tracks(LISP filename1, LISP filename2, LISP lweights); 96 void acost_dt_params(LISP params); 97 float ac_unit_distance(const EST_Track &unit1, 98 const EST_Track &unit2, 99 const EST_FVector wghts); 100 float frame_distance(const EST_Track &a, int ai, 101 const EST_Track &b, int bi, 102 const EST_FVector &wghts, 103 float f0_weight); 104 void cl_maybe_fix_pitch_c0(EST_Track *c); 105 106 CLDB *check_cldb(); 107 LISP cldb_list(void); 108 LISP cldb_select(LISP dbname); 109 LISP l_cl_mapping(LISP utt, LISP method); 110 111 #endif 112