} | } | ||||
} | } | ||||
} | } | ||||
// Tables of the relative lengths of vowels, depending on the | |||||
// type of the two phonemes that follow | |||||
// indexes are the "length_mod" value for the following phonemes | |||||
// use this table if vowel is not the last in the word | |||||
static unsigned char length_mods_en[100] = { | |||||
// a , t s n d z r N <- next | |||||
100, 120, 100, 105, 100, 110, 110, 100, 95, 100, // a <- next2 | |||||
105, 120, 105, 110, 125, 130, 135, 115, 125, 100, // , | |||||
105, 120, 75, 100, 75, 105, 120, 85, 75, 100, // t | |||||
105, 120, 85, 105, 95, 115, 120, 100, 95, 100, // s | |||||
110, 120, 95, 105, 100, 115, 120, 100, 100, 100, // n | |||||
105, 120, 100, 105, 95, 115, 120, 110, 95, 100, // d | |||||
105, 120, 100, 105, 105, 122, 125, 110, 105, 100, // z | |||||
105, 120, 100, 105, 105, 122, 125, 110, 105, 100, // r | |||||
105, 120, 95, 105, 100, 115, 120, 110, 100, 100, // N | |||||
100, 120, 100, 100, 100, 100, 100, 100, 100, 100 | |||||
}; | |||||
// as above, but for the last syllable in a word | |||||
static unsigned char length_mods_en0[100] = { | |||||
// a , t s n d z r N <- next | |||||
100, 150, 100, 105, 110, 115, 110, 110, 110, 100, // a <- next2 | |||||
105, 150, 105, 110, 125, 135, 140, 115, 135, 100, // , | |||||
105, 150, 90, 105, 90, 122, 135, 100, 90, 100, // t | |||||
105, 150, 100, 105, 100, 122, 135, 100, 100, 100, // s | |||||
105, 150, 100, 105, 105, 115, 135, 110, 105, 100, // n | |||||
105, 150, 100, 105, 105, 122, 130, 120, 125, 100, // d | |||||
105, 150, 100, 105, 110, 122, 125, 115, 110, 100, // z | |||||
105, 150, 100, 105, 105, 122, 135, 120, 105, 100, // r | |||||
105, 150, 100, 105, 105, 115, 135, 110, 105, 100, // N | |||||
100, 100, 100, 100, 100, 100, 100, 100, 100, 100 | |||||
}; | |||||
static unsigned char length_mods_equal[100] = { | |||||
// a , t s n d z r N <- next | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // a <- next2 | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // , | |||||
110, 120, 100, 110, 100, 110, 110, 110, 100, 110, // t | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // s | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // n | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // d | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // z | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // r | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // N | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110 | |||||
}; | |||||
static unsigned char *length_mod_tabs[6] = { | |||||
length_mods_en, | |||||
length_mods_en, // 1 | |||||
length_mods_en0, // 2 | |||||
length_mods_equal, // 3 | |||||
length_mods_equal, // 4 | |||||
length_mods_equal // 5 | |||||
}; | |||||
void SetLengthMods(Translator *tr, int value) | |||||
{ | |||||
int value2; | |||||
tr->langopts.length_mods0 = tr->langopts.length_mods = length_mod_tabs[value % 100]; | |||||
if ((value2 = value / 100) != 0) | |||||
tr->langopts.length_mods0 = length_mod_tabs[value2]; | |||||
} |
#endif | #endif | ||||
void CalcLengths(Translator *tr); | void CalcLengths(Translator *tr); | ||||
void SetLengthMods(Translator *tr, int value); | |||||
espeak_ng_STATUS SetParameter(int parameter, | espeak_ng_STATUS SetParameter(int parameter, | ||||
int value, | int value, |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "setlengths.h" // for SetLengthMods | |||||
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, NUM... | #include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, NUM... | ||||
// start of unicode pages for character sets | // start of unicode pages for character sets |
// other characters which break a word, but don't produce a pause | // other characters which break a word, but don't produce a pause | ||||
static const unsigned short breaks[] = { '_', 0 }; | static const unsigned short breaks[] = { '_', 0 }; | ||||
// Tables of the relative lengths of vowels, depending on the | |||||
// type of the two phonemes that follow | |||||
// indexes are the "length_mod" value for the following phonemes | |||||
// use this table if vowel is not the last in the word | |||||
static unsigned char length_mods_en[100] = { | |||||
// a , t s n d z r N <- next | |||||
100, 120, 100, 105, 100, 110, 110, 100, 95, 100, // a <- next2 | |||||
105, 120, 105, 110, 125, 130, 135, 115, 125, 100, // , | |||||
105, 120, 75, 100, 75, 105, 120, 85, 75, 100, // t | |||||
105, 120, 85, 105, 95, 115, 120, 100, 95, 100, // s | |||||
110, 120, 95, 105, 100, 115, 120, 100, 100, 100, // n | |||||
105, 120, 100, 105, 95, 115, 120, 110, 95, 100, // d | |||||
105, 120, 100, 105, 105, 122, 125, 110, 105, 100, // z | |||||
105, 120, 100, 105, 105, 122, 125, 110, 105, 100, // r | |||||
105, 120, 95, 105, 100, 115, 120, 110, 100, 100, // N | |||||
100, 120, 100, 100, 100, 100, 100, 100, 100, 100 | |||||
}; | |||||
// as above, but for the last syllable in a word | |||||
static unsigned char length_mods_en0[100] = { | |||||
// a , t s n d z r N <- next | |||||
100, 150, 100, 105, 110, 115, 110, 110, 110, 100, // a <- next2 | |||||
105, 150, 105, 110, 125, 135, 140, 115, 135, 100, // , | |||||
105, 150, 90, 105, 90, 122, 135, 100, 90, 100, // t | |||||
105, 150, 100, 105, 100, 122, 135, 100, 100, 100, // s | |||||
105, 150, 100, 105, 105, 115, 135, 110, 105, 100, // n | |||||
105, 150, 100, 105, 105, 122, 130, 120, 125, 100, // d | |||||
105, 150, 100, 105, 110, 122, 125, 115, 110, 100, // z | |||||
105, 150, 100, 105, 105, 122, 135, 120, 105, 100, // r | |||||
105, 150, 100, 105, 105, 115, 135, 110, 105, 100, // N | |||||
100, 100, 100, 100, 100, 100, 100, 100, 100, 100 | |||||
}; | |||||
static unsigned char length_mods_equal[100] = { | |||||
// a , t s n d z r N <- next | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // a <- next2 | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // , | |||||
110, 120, 100, 110, 100, 110, 110, 110, 100, 110, // t | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // s | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // n | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // d | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // z | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // r | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110, // N | |||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110 | |||||
}; | |||||
static unsigned char *length_mod_tabs[6] = { | |||||
length_mods_en, | |||||
length_mods_en, // 1 | |||||
length_mods_en0, // 2 | |||||
length_mods_equal, // 3 | |||||
length_mods_equal, // 4 | |||||
length_mods_equal // 5 | |||||
}; | |||||
void SetLengthMods(Translator *tr, int value) | |||||
{ | |||||
int value2; | |||||
tr->langopts.length_mods0 = tr->langopts.length_mods = length_mod_tabs[value % 100]; | |||||
if ((value2 = value / 100) != 0) | |||||
tr->langopts.length_mods0 = length_mod_tabs[value2]; | |||||
} | |||||
int IsAlpha(unsigned int c) | int IsAlpha(unsigned int c) | ||||
{ | { | ||||
// Replacement for iswalph() which also checks for some in-word symbols | // Replacement for iswalph() which also checks for some in-word symbols |
extern int (*uri_callback)(int, const char *, const char *); | extern int (*uri_callback)(int, const char *, const char *); | ||||
extern int (*phoneme_callback)(const char *); | extern int (*phoneme_callback)(const char *); | ||||
extern void SetLengthMods(Translator *tr, int value); | |||||
#define LEADING_2_BITS 0xC0 // 0b11000000 | #define LEADING_2_BITS 0xC0 // 0b11000000 | ||||
#define UTF8_TAIL_BITS 0x80 // 0b10000000 | #define UTF8_TAIL_BITS 0x80 // 0b10000000 |
#include "dictionary.h" // for strncpy0, LoadDictionary | #include "dictionary.h" // for strncpy0, LoadDictionary | ||||
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB | #include "mnemonics.h" // for LookupMnemName, MNEM_TAB | ||||
#include "phoneme.h" // for REPLACE_PHONEMES, n_replace_pho... | #include "phoneme.h" // for REPLACE_PHONEMES, n_replace_pho... | ||||
#include "setlengths.h" // for SetLengthMods | |||||
#include "speech.h" // for GetFileLength, PATHSEP | #include "speech.h" // for GetFileLength, PATHSEP | ||||
#include "mbrola.h" // for LoadMbrolaTable | #include "mbrola.h" // for LoadMbrolaTable | ||||
#include "synthdata.h" // for SelectPhonemeTableName, LookupP... | #include "synthdata.h" // for SelectPhonemeTableName, LookupP... |