| 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 ([email protected]) */ |
| 34 |
/* Date: April 2001 */ |
| 35 |
/*************************************************************************/ |
| 36 |
/* */ |
| 37 |
/* clunits db */ |
| 38 |
/* */ |
| 39 |
/*************************************************************************/ |
| 40 |
#ifndef _CST_CLUNITS_H__ |
| 41 |
#define _CST_CLUNITS_H__ |
| 42 |
|
| 43 |
#include "cst_wave.h" |
| 44 |
#include "cst_cart.h" |
| 45 |
#include "cst_viterbi.h" |
| 46 |
#include "cst_track.h" |
| 47 |
#include "cst_sts.h" |
| 48 |
|
| 49 |
#define CLUNIT_NONE (unsigned short)65535 |
| 50 |
|
| 51 |
typedef struct cst_clunit_struct { |
| 52 |
unsigned short type, phone; |
| 53 |
int start, end; |
| 54 |
int prev, next; |
| 55 |
} cst_clunit; |
| 56 |
|
| 57 |
typedef struct cst_clunit_type_struct { |
| 58 |
const char *name; |
| 59 |
int start, count; |
| 60 |
} cst_clunit_type; |
| 61 |
|
| 62 |
typedef struct cst_clunit_db_struct { |
| 63 |
const char *name; |
| 64 |
const cst_clunit_type *types; |
| 65 |
const cst_cart * const *trees; |
| 66 |
const cst_clunit *units; |
| 67 |
int num_types, num_units; |
| 68 |
|
| 69 |
/* These may be set up at runtime (in file-mapped databases) */ |
| 70 |
cst_sts_list *sts, *mcep; |
| 71 |
|
| 72 |
/* These are pre-scaled by 65536 to accomodate fixed-point machines */ |
| 73 |
const int *join_weights; |
| 74 |
|
| 75 |
/* Misc. important parameters */ |
| 76 |
int optimal_coupling; |
| 77 |
int extend_selections; |
| 78 |
int f0_weight; |
| 79 |
char *(*unit_name_func)(cst_item *s); |
| 80 |
} cst_clunit_db; |
| 81 |
|
| 82 |
CST_VAL_USER_TYPE_DCLS(clunit_db,cst_clunit_db) |
| 83 |
CST_VAL_USER_TYPE_DCLS(vit_cand,cst_vit_cand) |
| 84 |
|
| 85 |
cst_utterance *clunits_synth(cst_utterance *utt); |
| 86 |
cst_utterance *clunits_dump_units(cst_utterance *utt); |
| 87 |
|
| 88 |
char *clunits_ldom_phone_word(cst_item *s); |
| 89 |
int clunit_get_unit_index(cst_clunit_db *cludb, |
| 90 |
const char *unit_type, |
| 91 |
int instance); |
| 92 |
int clunit_get_unit_index_name(cst_clunit_db *cludb, |
| 93 |
const char *name); |
| 94 |
/* Used to test if the unit name is in the database, -1 if not */ |
| 95 |
int clunit_get_unit_type_index(cst_clunit_db *cludb, const char *name); |
| 96 |
|
| 97 |
#define UNIT_TYPE(db,u) ((db)->types[(db)->units[(u)].type].name) |
| 98 |
#define UNIT_INDEX(db,u) ((u) - (db)->types[(db)->units[(u)].type].start) |
| 99 |
|
| 100 |
#endif |