Debian Codegraph @

tools/VOICE_ldom.c

raw
1 /*************************************************************************/
2 /* */
3 /* Language Technologies Institute */
4 /* Carnegie Mellon University */
5 /* Copyright (c) 1999-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 ([email protected]) */
34 /* Date: September 2002 */
35 /*************************************************************************/
36 /* */
37 /* A simple ldom voice defintion */
38 /* */
39 /*************************************************************************/
40
41 #include <string.h>
42 #include "flite.h"
43 #include "cst_clunits.h"
44 #include "usenglish.h"
45 #include "cmulex.h"
46
47 static char *__VOICENAME___unit_name(cst_item *s);
48
49 extern cst_clunit_db __VOICENAME___db;
50 cst_voice *__VOICENAME___clunits = NULL;
51
52 cst_voice *register___VOICENAME__(const char *voxdir)
53 {
54 cst_voice *v = new_voice();
55
56 v->name = "__NICKNAME__";
57
58 /* Sets up language specific parameters in the __VOICENAME__. */
59 usenglish_init(v);
60
61 /* Things that weren't filled in already. */
62 feat_set_string(v->features,"name","__VOICENAME__");
63
64 /* Lexicon */
65 cmu_lex_init();
66 feat_set(v->features,"lexicon",lexicon_val(&cmu_lex));
67
68 /* Waveform synthesis */
69 feat_set(v->features,"wave_synth_func",uttfunc_val(&clunits_synth));
70 feat_set(v->features,"clunit_db",clunit_db_val(&__VOICENAME___db));
71 feat_set_int(v->features,"sample_rate",__VOICENAME___db.sts->sample_rate);
72 feat_set_string(v->features,"join_type","simple_join");
73 feat_set_string(v->features,"resynth_type","fixed");
74
75 /* Unit selection */
76 __VOICENAME___db.unit_name_func = __VOICENAME___unit_name;
77
78 __VOICENAME___clunits = v;
79
80 return __VOICENAME___clunits;
81 }
82
83 void unregister___VOICENAME__(cst_voice *vox)
84 {
85 if (vox != __VOICENAME___clunits)
86 return;
87 delete_voice(vox);
88 __VOICENAME___clunits = NULL;
89 }
90
91 static char *__VOICENAME___unit_name(cst_item *s)
92 {
93 return clunits_ldom_phone_word(s);
94 }