Initial import to Gerrit.
[profile/ivi/festival.git] / src / modules / UniSyn_diphone / us_diphone.h
1 /*************************************************************************/
2 /*                                                                       */
3 /*                Centre for Speech Technology Research                  */
4 /*                     University of Edinburgh, UK                       */
5 /*                       Copyright (c) 1996,1997                         */
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 /*  THE UNIVERSITY OF EDINBURGH 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 THE UNIVERSITY OF EDINBURGH 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 /*                                                                       */
34 /*                 Author: Paul Taylor                                   */
35 /*                   Date: 6 Jan 1998                                    */
36 /* --------------------------------------------------------------------- */
37 /*            LPC residual synthesis alternative version                 */
38 /*                                                                       */
39 /*************************************************************************/
40
41 #ifndef __US_DIPHONE_H__
42 #define __US_DIPHONE_H__
43
44 #include "EST_FileType.h"
45 #include "EST_TVector.h"
46 #include "EST_THash.h"
47 #include "EST_Token.h"
48 #include "ling_class/EST_Relation.h"
49
50 SIOD_REGISTER_CLASS_DCLS(us_db,USDiphIndex)
51 VAL_REGISTER_CLASS_DCLS(us_db,USDiphIndex)
52
53 class USDiphIndex {
54 public:
55     USDiphIndex();
56     ~USDiphIndex();
57
58     EST_String name;
59     EST_String index_file;
60     EST_String group_file;
61     EST_String track_file_format;
62     EST_String sig_file_format;
63     bool grouped;
64     int index_offset;
65     EST_TokenStream ts; // for grouped diphones
66
67     EST_String coef_dir;
68     EST_String sig_dir;
69
70     EST_String coef_ext;
71     EST_String sig_ext;
72     LISP params;
73
74     EST_TVector<EST_Item> diphone;
75     EST_TStringHash<int> dihash;
76 };
77
78 int read_diphone_database(const EST_String &filename, USDiphIndex &index);
79 void check_us_db();
80
81 void load_separate_diphone(int unit, bool keep_full, 
82                            const EST_String &cut_type="all");
83
84 int find_diphone_index(const EST_Item &d);
85
86 void parse_diphone_times(EST_Relation &diphone_stream, 
87                                 EST_Relation &source_lab);
88
89 void us_get_diphones(EST_Utterance &utt);
90
91 void us_full_cut(EST_Relation &unit);
92
93 LISP us_check_diphone_presence(LISP name);
94
95
96 #endif // __US_DIPHONE_H__
97