mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
Merge branch 'master' of https://github.com/espeak-ng/espeak-ng
This commit is contained in:
@@ -38,8 +38,6 @@ extern int GetFileLength(const char *filename);
|
||||
// This version of the command-line speak program uses the
|
||||
// libespeak.so.1 library
|
||||
|
||||
|
||||
|
||||
static const char *help_text =
|
||||
"\nespeak-ng [options] [\"<words>\"]\n\n"
|
||||
"-f <text file> Text file to speak\n"
|
||||
@@ -102,9 +100,6 @@ static const char *help_text =
|
||||
"\t List the available voices for the specified language.\n"
|
||||
"\t If <language> is omitted, then list all voices.\n";
|
||||
|
||||
|
||||
|
||||
|
||||
int samplerate;
|
||||
int quiet = 0;
|
||||
unsigned int samples_total = 0;
|
||||
@@ -116,7 +111,6 @@ FILE *f_wavfile = NULL;
|
||||
char filetype[5];
|
||||
char wavefile[200];
|
||||
|
||||
|
||||
void DisplayVoices(FILE *f_out, char *language)
|
||||
{
|
||||
int ix;
|
||||
@@ -177,9 +171,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Write4Bytes(FILE *f, int value)
|
||||
{
|
||||
// Write 4 bytes to a file, least significant first
|
||||
@@ -191,8 +182,6 @@ static void Write4Bytes(FILE *f, int value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int OpenWavFile(char *path, int rate)
|
||||
{
|
||||
static unsigned char wave_hdr[44] = {
|
||||
@@ -219,7 +208,6 @@ int OpenWavFile(char *path, int rate)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
fwrite(wave_hdr, 1, 24, f_wavfile);
|
||||
Write4Bytes(f_wavfile, rate);
|
||||
Write4Bytes(f_wavfile, rate * 2);
|
||||
@@ -227,8 +215,6 @@ int OpenWavFile(char *path, int rate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CloseWavFile()
|
||||
{
|
||||
unsigned int pos;
|
||||
@@ -250,7 +236,6 @@ static void CloseWavFile()
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
|
||||
{
|
||||
char fname[210];
|
||||
@@ -295,7 +280,6 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void PrintVersion()
|
||||
{
|
||||
const char *version;
|
||||
@@ -305,8 +289,6 @@ static void PrintVersion()
|
||||
printf("eSpeak text-to-speech: %s Data at: %s\n", version, path_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NEED_GETOPT
|
||||
struct option {
|
||||
char *name;
|
||||
@@ -349,7 +331,6 @@ int main(int argc, char **argv)
|
||||
|
||||
static const char *err_load = "Failed to read ";
|
||||
|
||||
|
||||
FILE *f_text = NULL;
|
||||
char *p_text = NULL;
|
||||
FILE *f_phonemes_out = stdout;
|
||||
@@ -451,87 +432,68 @@ int main(int argc, char **argv)
|
||||
else
|
||||
synth_flags |= espeakCHARS_8BIT;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
printf("\n");
|
||||
PrintVersion();
|
||||
printf("%s", help_text);
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
option_capitals = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
phoneme_options |= espeakPHONEMES_SHOW;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
phoneme_options |= espeakPHONEMES_TRACE;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
synth_flags |= espeakSSML;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
pitch = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
strncpy0(filename, optarg2, sizeof(filename));
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
option_linelength = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
volume = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
speed = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
wordgap = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
strncpy0(voicename, optarg2, sizeof(voicename));
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
option_waveout = 1;
|
||||
strncpy0(wavefile, optarg2, sizeof(filename));
|
||||
break;
|
||||
|
||||
case 'z': // remove pause from the end of a sentence
|
||||
synth_flags &= ~espeakENDPAUSE;
|
||||
break;
|
||||
|
||||
case 0x100: // --stdin
|
||||
flag_stdin = 1;
|
||||
break;
|
||||
|
||||
case 0x105: // --stdout
|
||||
option_waveout = 1;
|
||||
strcpy(wavefile, "stdout");
|
||||
break;
|
||||
|
||||
case 0x101: // --compile-debug
|
||||
case 0x102: // --compile
|
||||
strncpy0(voicename, optarg2, sizeof(voicename));
|
||||
flag_compile = c;
|
||||
quiet = 1;
|
||||
break;
|
||||
|
||||
case 0x103: // --punct
|
||||
option_punctuation = 1;
|
||||
if (optarg2 != NULL) {
|
||||
@@ -541,32 +503,26 @@ int main(int argc, char **argv)
|
||||
option_punctuation = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x104: // --voices
|
||||
espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, data_path, 0);
|
||||
DisplayVoices(stdout, optarg2);
|
||||
exit(0);
|
||||
|
||||
case 0x106: // -- split
|
||||
if (optarg2 == NULL)
|
||||
samples_split_seconds = 30 * 60; // default 30 minutes
|
||||
else
|
||||
samples_split_seconds = atoi(optarg2) * 60;
|
||||
break;
|
||||
|
||||
case 0x107: // --path
|
||||
data_path = optarg2;
|
||||
break;
|
||||
|
||||
case 0x108: // --phonout
|
||||
if ((f_phonemes_out = fopen(optarg2, "w")) == NULL)
|
||||
fprintf(stderr, "Can't write to: %s\n", optarg2);
|
||||
break;
|
||||
|
||||
case 0x109: // --pho
|
||||
phoneme_options |= espeakPHONEMES_MBROLA;
|
||||
break;
|
||||
|
||||
case 0x10a: // --ipa
|
||||
phoneme_options |= espeakPHONEMES_IPA;
|
||||
if (optarg2 != NULL) {
|
||||
@@ -588,11 +544,9 @@ int main(int argc, char **argv)
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x10b: // --version
|
||||
PrintVersion();
|
||||
exit(0);
|
||||
|
||||
case 0x10c: // --sep
|
||||
phoneme_options |= espeakPHONEMES_SHOW;
|
||||
if (optarg2 == 0)
|
||||
@@ -602,7 +556,6 @@ int main(int argc, char **argv)
|
||||
if (phonemes_separator == 'z')
|
||||
phonemes_separator = 0x200c; // ZWNJ
|
||||
break;
|
||||
|
||||
case 0x10d: // --tie
|
||||
phoneme_options |= (espeakPHONEMES_SHOW | espeakPHONEMES_TIE);
|
||||
if (optarg2 == 0)
|
||||
@@ -612,28 +565,23 @@ int main(int argc, char **argv)
|
||||
if (phonemes_separator == 'z')
|
||||
phonemes_separator = 0x200d; // ZWJ
|
||||
break;
|
||||
|
||||
case 0x10e: // --compile-mbrola
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
|
||||
espeak_ng_CompileMbrolaVoice(optarg2, stdout);
|
||||
exit(0);
|
||||
|
||||
case 0x10f: // --compile-intonations
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompileIntonation(stdout);
|
||||
exit(0);
|
||||
|
||||
case 0x110: // --compile-phonemes
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY);
|
||||
espeak_ng_CompilePhonemeData(22050, stdout);
|
||||
exit(0);
|
||||
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (option_waveout || quiet) {
|
||||
// writing to a file (or no output), we can use synchronous mode
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, data_path, 0);
|
||||
@@ -653,7 +601,6 @@ int main(int argc, char **argv)
|
||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
|
||||
}
|
||||
|
||||
|
||||
if (voicename[0] == 0)
|
||||
strcpy(voicename, "default");
|
||||
|
||||
@@ -690,7 +637,6 @@ int main(int argc, char **argv)
|
||||
if (option_punctuation == 2)
|
||||
espeak_SetPunctuationList(option_punctlist);
|
||||
|
||||
|
||||
espeak_SetPhonemeTrace(phoneme_options | (phonemes_separator << 8), f_phonemes_out);
|
||||
|
||||
if (filename[0] == 0) {
|
||||
@@ -713,7 +659,6 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (p_text != NULL) {
|
||||
int size;
|
||||
size = strlen(p_text);
|
||||
|
||||
@@ -101,8 +101,6 @@ static keywtab_t k_conditions[] = {
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
static keywtab_t k_properties[] = {
|
||||
{ "isPause", 0, phPAUSE },
|
||||
{ "isVowel", 0, phVOWEL },
|
||||
@@ -238,7 +236,6 @@ static keywtab_t keywords[] = {
|
||||
{ "afr", tPHONEME_TYPE, phSTOP }, // treat as stop
|
||||
{ "apr", tPHONEME_TYPE, phFRICATIVE }, // [h] voiceless approximant
|
||||
|
||||
|
||||
// keywords
|
||||
{ "phonemenumber", tSTATEMENT, kPHONEMENUMBER },
|
||||
{ "phonemetable", tSTATEMENT, kPHONEMETABLE },
|
||||
@@ -256,7 +253,6 @@ static keywtab_t keywords[] = {
|
||||
{ "endtype", tSTATEMENT, kENDTYPE },
|
||||
{ "voicingswitch", tSTATEMENT, kVOICINGSWITCH },
|
||||
|
||||
|
||||
{ "IF", tSTATEMENT, kIF },
|
||||
{ "ELSE", tSTATEMENT, kELSE },
|
||||
{ "ELIF", tSTATEMENT, kELIF },
|
||||
@@ -276,7 +272,6 @@ static keywtab_t keywords[] = {
|
||||
{ "VowelEnding", tSTATEMENT, kVOWELENDING },
|
||||
{ "addWav", tSTATEMENT, kANDWAV },
|
||||
|
||||
|
||||
{ "Vowelin", tSTATEMENT, kVOWELIN },
|
||||
{ "Vowelout", tSTATEMENT, kVOWELOUT },
|
||||
{ "Continue", tSTATEMENT, kCONTINUE },
|
||||
@@ -359,12 +354,10 @@ static keywtab_t keywords[] = {
|
||||
{ NULL, 0, -1 }
|
||||
};
|
||||
|
||||
|
||||
static keywtab_t *keyword_tabs[] = {
|
||||
keywords, k_conditions, k_properties, k_intonation
|
||||
};
|
||||
|
||||
|
||||
static PHONEME_TAB *phoneme_out;
|
||||
|
||||
static int n_phcodes_list[N_PHONEME_TABS];
|
||||
@@ -376,7 +369,6 @@ static int place_articulation;
|
||||
static char *p_equivalence;
|
||||
static char equivalence_buf[20000];
|
||||
|
||||
|
||||
#define N_PROCS 50
|
||||
int n_procs;
|
||||
int proc_addr[N_PROCS];
|
||||
@@ -540,7 +532,6 @@ static void DecompilePhoneme(FILE *f_out, PHONEME_TAB *ph, int compile_phoneme)
|
||||
fprintf(f_out, ")");
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
if (type2 < 12) {
|
||||
@@ -593,17 +584,14 @@ static void DecompilePhoneme(FILE *f_out, PHONEME_TAB *ph, int compile_phoneme)
|
||||
}
|
||||
fprintf(f_out, ")");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
fprintf(f_out, "%s", instn_jumps[(instn >> 9) & 7]);
|
||||
fprintf(f_out, " %d", instn & 0x1ff);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
address = ((data1 & 0xf) << 4) + *pc++;
|
||||
fprintf(f_out, "CALL %.5x", address);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
fprintf(f_out, "%s", instn10_string[type2]);
|
||||
switch (type2)
|
||||
@@ -622,7 +610,6 @@ static void DecompilePhoneme(FILE *f_out, PHONEME_TAB *ph, int compile_phoneme)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
@@ -636,10 +623,6 @@ static void DecompilePhoneme(FILE *f_out, PHONEME_TAB *ph, int compile_phoneme)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int n_phoneme_tabs;
|
||||
static int n_phcodes;
|
||||
|
||||
@@ -652,12 +635,10 @@ static FILE *f_errors = NULL;
|
||||
static FILE *f_prog_log = NULL;
|
||||
static FILE *f_report;
|
||||
|
||||
|
||||
static FILE *f_in;
|
||||
static int f_in_linenum;
|
||||
static int f_in_displ;
|
||||
|
||||
|
||||
static int linenum;
|
||||
static int count_references = 0;
|
||||
static int duplicate_references = 0;
|
||||
@@ -682,13 +663,11 @@ typedef struct {
|
||||
|
||||
static REF_HASH_TAB *ref_hash_tab[256];
|
||||
|
||||
|
||||
#define N_ENVELOPES 30
|
||||
int n_envelopes = 0;
|
||||
char envelope_paths[N_ENVELOPES][80];
|
||||
unsigned char envelope_dat[N_ENVELOPES][ENV_LEN];
|
||||
|
||||
|
||||
typedef struct {
|
||||
FILE *file;
|
||||
int linenum;
|
||||
@@ -708,7 +687,6 @@ typedef struct {
|
||||
} IF_STACK;
|
||||
IF_STACK if_stack[N_IF_STACK];
|
||||
|
||||
|
||||
enum {
|
||||
tENDFILE = 1,
|
||||
tSTRING,
|
||||
@@ -727,8 +705,6 @@ int item_terminator;
|
||||
#define N_ITEM_STRING 256
|
||||
char item_string[N_ITEM_STRING];
|
||||
|
||||
|
||||
|
||||
static int ref_sorter(char **a, char **b)
|
||||
{
|
||||
int ix;
|
||||
@@ -747,8 +723,6 @@ static int ref_sorter(char **a, char **b)
|
||||
return p1->ph_mnemonic - p2->ph_mnemonic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CompileReport(void)
|
||||
{
|
||||
int ix;
|
||||
@@ -827,7 +801,6 @@ static void CompileReport(void)
|
||||
fclose(f_report);
|
||||
}
|
||||
|
||||
|
||||
static void error(const char *format, const char *string)
|
||||
{
|
||||
if (string == NULL)
|
||||
@@ -855,7 +828,6 @@ static FILE *fopen_log(FILE *f_log, const char *fname, const char *access)
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
static unsigned int StringToWord(const char *string)
|
||||
{
|
||||
// Pack 4 characters into a word
|
||||
@@ -875,7 +847,6 @@ static unsigned int StringToWord(const char *string)
|
||||
return word;
|
||||
}
|
||||
|
||||
|
||||
static MNEM_TAB reserved_phonemes[] = {
|
||||
{ "_\001", phonCONTROL }, // NOT USED
|
||||
{ "%", phonSTRESS_U },
|
||||
@@ -913,7 +884,6 @@ static MNEM_TAB reserved_phonemes[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
||||
static void ReservePhCodes()
|
||||
{
|
||||
// Reserve phoneme codes which have fixed numbers so that they can be
|
||||
@@ -932,7 +902,6 @@ static void ReservePhCodes()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int LookupPhoneme(const char *string, int control)
|
||||
{
|
||||
// control = 0 explicit declaration
|
||||
@@ -983,8 +952,6 @@ static int LookupPhoneme(const char *string, int control)
|
||||
return use;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned int get_char()
|
||||
{
|
||||
unsigned int c;
|
||||
@@ -1001,7 +968,6 @@ static void unget_char(unsigned int c)
|
||||
linenum--;
|
||||
}
|
||||
|
||||
|
||||
int CheckNextChar()
|
||||
{
|
||||
int c;
|
||||
@@ -1010,7 +976,6 @@ int CheckNextChar()
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
static int NextItem(int type)
|
||||
{
|
||||
int acc;
|
||||
@@ -1099,7 +1064,6 @@ static int NextItem(int type)
|
||||
return acc * sign;
|
||||
}
|
||||
|
||||
|
||||
if ((type >= tKEYWORD) && (type <= tINTONATION)) {
|
||||
pk = keyword_tabs[type-tKEYWORD];
|
||||
while (pk->mnem != NULL) {
|
||||
@@ -1117,8 +1081,6 @@ static int NextItem(int type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int NextItemMax(int max)
|
||||
{
|
||||
// Get a number, but restrict value to max
|
||||
@@ -1134,8 +1096,6 @@ static int NextItemMax(int max)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int NextItemBrackets(int type, int control)
|
||||
{
|
||||
// Expect a parameter inside parantheses
|
||||
@@ -1156,19 +1116,14 @@ static int NextItemBrackets(int type, int control)
|
||||
if (item_terminator != ')')
|
||||
error("Expected ')'", NULL);
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void UngetItem()
|
||||
{
|
||||
fseek(f_in, f_in_displ, SEEK_SET);
|
||||
linenum = f_in_linenum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int Range(int value, int divide, int min, int max)
|
||||
{
|
||||
if (value < 0)
|
||||
@@ -1184,7 +1139,6 @@ static int Range(int value, int divide, int min, int max)
|
||||
return value - min;
|
||||
}
|
||||
|
||||
|
||||
int CompileVowelTransition(int which)
|
||||
{
|
||||
// Compile a vowel transition
|
||||
@@ -1291,8 +1245,6 @@ int CompileVowelTransition(int which)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LoadSpect(const char *path, int control)
|
||||
{
|
||||
SpectSeq *spectseq;
|
||||
@@ -1470,8 +1422,6 @@ int LoadSpect(const char *path, int control)
|
||||
return displ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int LoadWavefile(FILE *f, const char *fname)
|
||||
{
|
||||
int displ;
|
||||
@@ -1523,7 +1473,6 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
if (system(command) != 0)
|
||||
failed = 1;
|
||||
|
||||
|
||||
if (failed || (GetFileLength(fname_temp) <= 0)) {
|
||||
if (resample_fails < 2)
|
||||
error("Resample command failed: %s", command);
|
||||
@@ -1569,7 +1518,6 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
max = sample;
|
||||
else if (sample < -max)
|
||||
max = -sample;
|
||||
|
||||
}
|
||||
|
||||
scale_factor = (max / 127) + 1;
|
||||
@@ -1620,8 +1568,6 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
return displ | 0x800000; // set bit 23 to indicate a wave file rather than a spectrum
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int LoadEnvelope(FILE *f, const char *fname)
|
||||
{
|
||||
int displ;
|
||||
@@ -1643,8 +1589,6 @@ static int LoadEnvelope(FILE *f, const char *fname)
|
||||
return displ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Generate a hash code from the specified string */
|
||||
static int Hash8(const char *string)
|
||||
{
|
||||
@@ -1662,8 +1606,6 @@ static int Hash8(const char *string)
|
||||
return (hash+chars) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int LoadEnvelope2(FILE *f, const char *fname)
|
||||
{
|
||||
int ix, ix2;
|
||||
@@ -1714,7 +1656,6 @@ static int LoadEnvelope2(FILE *f, const char *fname)
|
||||
env[x] = y;
|
||||
}
|
||||
|
||||
|
||||
if (n_envelopes < N_ENVELOPES) {
|
||||
strncpy0(envelope_paths[n_envelopes], fname, sizeof(envelope_paths[0]));
|
||||
memcpy(envelope_dat[n_envelopes], env, ENV_LEN);
|
||||
@@ -1809,7 +1750,6 @@ static int LoadDataFile(const char *path, int control)
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
static int CompileToneSpec(void)
|
||||
{
|
||||
int pitch1 = 0;
|
||||
@@ -1888,8 +1828,6 @@ int CompileSound(int keyword, int isvowel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Condition
|
||||
bits 14,15 1
|
||||
@@ -1901,7 +1839,6 @@ int CompileSound(int keyword, int isvowel)
|
||||
=8 data = stress bitmap
|
||||
=9 special tests
|
||||
*/
|
||||
|
||||
int CompileIf(int elif)
|
||||
{
|
||||
int key;
|
||||
@@ -2011,7 +1948,6 @@ int CompileIf(int elif)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FillThen(int add)
|
||||
{
|
||||
USHORT *p;
|
||||
@@ -2040,7 +1976,6 @@ void FillThen(int add)
|
||||
then_count = 0;
|
||||
}
|
||||
|
||||
|
||||
int CompileElse(void)
|
||||
{
|
||||
USHORT *ref;
|
||||
@@ -2068,7 +2003,6 @@ int CompileElse(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CompileElif(void)
|
||||
{
|
||||
if (if_level < 1) {
|
||||
@@ -2081,7 +2015,6 @@ int CompileElif(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CompileEndif(void)
|
||||
{
|
||||
USHORT *p;
|
||||
@@ -2112,7 +2045,6 @@ int CompileEndif(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int CompileSwitch(int type)
|
||||
{
|
||||
// Type 0: EndSwitch
|
||||
@@ -2131,8 +2063,6 @@ static int CompileSwitch(int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PHONEME_TAB_LIST *FindPhonemeTable(const char *string)
|
||||
{
|
||||
int ix;
|
||||
@@ -2145,8 +2075,6 @@ static PHONEME_TAB_LIST *FindPhonemeTable(const char *string)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PHONEME_TAB *FindPhoneme(const char *string)
|
||||
{
|
||||
PHONEME_TAB_LIST *phtab = NULL;
|
||||
@@ -2178,7 +2106,6 @@ static PHONEME_TAB *FindPhoneme(const char *string)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void ImportPhoneme(void)
|
||||
{
|
||||
unsigned int ph_mnem;
|
||||
@@ -2198,10 +2125,8 @@ static void ImportPhoneme(void)
|
||||
if (phoneme_out->type != phVOWEL) {
|
||||
phoneme_out->end_type = 0; // voicingswitch, this must be set later to refer to a local phoneme
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void CallPhoneme(void)
|
||||
{
|
||||
PHONEME_TAB *ph;
|
||||
@@ -2239,7 +2164,6 @@ static void CallPhoneme(void)
|
||||
*prog_out++ = addr;
|
||||
}
|
||||
|
||||
|
||||
static void DecThenCount()
|
||||
{
|
||||
if (then_count > 0)
|
||||
@@ -2254,7 +2178,6 @@ static void InstnPlusPhoneme(int instn)
|
||||
*prog_out++ = instn + phcode;
|
||||
}
|
||||
|
||||
|
||||
int CompilePhoneme(int compile_phoneme)
|
||||
{
|
||||
int endphoneme = 0;
|
||||
@@ -2323,17 +2246,14 @@ int CompilePhoneme(int compile_phoneme)
|
||||
error("More than one phoneme type: %s", item_string);
|
||||
phoneme_out->type = keyword;
|
||||
break;
|
||||
|
||||
case tPLACE:
|
||||
if (place_articulation > 0)
|
||||
error("Place of articulation has already been given: %s", item_string);
|
||||
place_articulation = keyword;
|
||||
break;
|
||||
|
||||
case tPHONEME_FLAG:
|
||||
phoneme_flags |= keyword;
|
||||
break;
|
||||
|
||||
case tINSTRN1:
|
||||
// instruction group 0, with 8 bit operands which set data in PHONEME_DATA
|
||||
switch (keyword)
|
||||
@@ -2351,19 +2271,16 @@ int CompilePhoneme(int compile_phoneme)
|
||||
InstnPlusPhoneme(keyword << 8);
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case i_PAUSE_BEFORE:
|
||||
value = NextItemMax(255);
|
||||
*prog_out++ = (i_PAUSE_BEFORE << 8) + value;
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case i_PAUSE_AFTER:
|
||||
value = NextItemMax(255);
|
||||
*prog_out++ = (i_PAUSE_AFTER << 8) + value;
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case i_SET_LENGTH:
|
||||
value = NextItemMax(511);
|
||||
if (phoneme_out->type == phVOWEL)
|
||||
@@ -2376,18 +2293,15 @@ int CompilePhoneme(int compile_phoneme)
|
||||
DecThenCount();
|
||||
}
|
||||
break;
|
||||
|
||||
case i_ADD_LENGTH:
|
||||
value = NextItem(tSIGNEDNUMBER) / 2;
|
||||
*prog_out++ = (i_ADD_LENGTH << 8) + (value & 0xff);
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case i_LENGTH_MOD:
|
||||
value = NextItem(tNUMBER);
|
||||
phoneme_out->length_mod = value;
|
||||
break;
|
||||
|
||||
case i_IPA_NAME:
|
||||
NextItem(tSTRING);
|
||||
|
||||
@@ -2442,7 +2356,6 @@ int CompilePhoneme(int compile_phoneme)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case tSTATEMENT:
|
||||
switch (keyword)
|
||||
{
|
||||
@@ -2450,14 +2363,12 @@ int CompilePhoneme(int compile_phoneme)
|
||||
ImportPhoneme();
|
||||
phoneme_flags = phoneme_out->phflags;
|
||||
break;
|
||||
|
||||
case kSTARTTYPE:
|
||||
phcode = NextItem(tPHONEMEMNEM);
|
||||
if (phcode == -1)
|
||||
phcode = LookupPhoneme(item_string, 1);
|
||||
phoneme_out->start_type = phcode;
|
||||
break;
|
||||
|
||||
case kENDTYPE:
|
||||
phcode = NextItem(tPHONEMEMNEM);
|
||||
if (phcode == -1)
|
||||
@@ -2467,14 +2378,12 @@ int CompilePhoneme(int compile_phoneme)
|
||||
else if (phcode != phoneme_out->start_type)
|
||||
error("endtype must equal starttype for consonants", NULL);
|
||||
break;
|
||||
|
||||
case kVOICINGSWITCH:
|
||||
phcode = NextItem(tPHONEMEMNEM);
|
||||
if (phcode == -1)
|
||||
phcode = LookupPhoneme(item_string, 1);
|
||||
phoneme_out->end_type = phcode; // use end_type field for consonants as voicing_switch
|
||||
break;
|
||||
|
||||
case kSTRESSTYPE:
|
||||
value = NextItem(tNUMBER);
|
||||
phoneme_out->std_length = value;
|
||||
@@ -2483,39 +2392,30 @@ int CompilePhoneme(int compile_phoneme)
|
||||
prog_out = prog_buf;
|
||||
}
|
||||
break;
|
||||
|
||||
case kIF:
|
||||
endphoneme = CompileIf(0);
|
||||
break;
|
||||
|
||||
case kELSE:
|
||||
endphoneme = CompileElse();
|
||||
break;
|
||||
|
||||
case kELIF:
|
||||
endphoneme = CompileElif();
|
||||
break;
|
||||
|
||||
case kENDIF:
|
||||
endphoneme = CompileEndif();
|
||||
break;
|
||||
|
||||
case kENDSWITCH:
|
||||
break;
|
||||
|
||||
case kSWITCH_PREVVOWEL:
|
||||
endphoneme = CompileSwitch(1);
|
||||
break;
|
||||
|
||||
case kSWITCH_NEXTVOWEL:
|
||||
endphoneme = CompileSwitch(2);
|
||||
break;
|
||||
|
||||
case kCALLPH:
|
||||
CallPhoneme();
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case kFMT:
|
||||
if_stack[if_level].returned = 1;
|
||||
DecThenCount();
|
||||
@@ -2524,45 +2424,40 @@ int CompilePhoneme(int compile_phoneme)
|
||||
else
|
||||
endphoneme = CompileSound(keyword, 0);
|
||||
break;
|
||||
|
||||
case kWAV:
|
||||
if_stack[if_level].returned = 1;
|
||||
// fallthrough:
|
||||
case kVOWELSTART:
|
||||
case kVOWELENDING:
|
||||
case kANDWAV:
|
||||
DecThenCount();
|
||||
endphoneme = CompileSound(keyword, 0);
|
||||
break;
|
||||
|
||||
case kVOWELIN:
|
||||
DecThenCount();
|
||||
endphoneme = CompileVowelTransition(1);
|
||||
break;
|
||||
|
||||
case kVOWELOUT:
|
||||
DecThenCount();
|
||||
endphoneme = CompileVowelTransition(2);
|
||||
break;
|
||||
|
||||
case kTONESPEC:
|
||||
DecThenCount();
|
||||
endphoneme = CompileToneSpec();
|
||||
break;
|
||||
|
||||
case kCONTINUE:
|
||||
*prog_out++ = i_CONTINUE;
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case kRETURN:
|
||||
*prog_out++ = i_RETURN;
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
case kINCLUDE:
|
||||
case kPHONEMENUMBER:
|
||||
case kPHONEMETABLE:
|
||||
error("Missing 'endphoneme' before '%s'", item_string); // drop through to endphoneme
|
||||
// fallthrough:
|
||||
case kENDPHONEME:
|
||||
case kENDPROCEDURE:
|
||||
endphoneme = 1;
|
||||
@@ -2572,7 +2467,6 @@ int CompilePhoneme(int compile_phoneme)
|
||||
*prog_out++ = i_RETURN;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2627,10 +2521,6 @@ int CompilePhoneme(int compile_phoneme)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void WritePhonemeTables()
|
||||
{
|
||||
int ix;
|
||||
@@ -2683,7 +2573,6 @@ static void WritePhonemeTables()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void EndPhonemeTable()
|
||||
{
|
||||
int ix;
|
||||
@@ -2720,7 +2609,6 @@ static void EndPhonemeTable()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void StartPhonemeTable(const char *name)
|
||||
{
|
||||
int ix;
|
||||
@@ -2772,7 +2660,6 @@ static void StartPhonemeTable(const char *name)
|
||||
n_phoneme_tabs++;
|
||||
}
|
||||
|
||||
|
||||
static void CompileEquivalents()
|
||||
{
|
||||
// a list of phonemes in another language and the equivalent phoneme strings in this language
|
||||
@@ -2866,8 +2753,6 @@ static void CompileEquivalents()
|
||||
p_start[3] = n_bytes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CompilePhonemeFiles()
|
||||
{
|
||||
int item;
|
||||
@@ -2900,7 +2785,6 @@ static void CompilePhonemeFiles()
|
||||
{
|
||||
case kUTF8_BOM:
|
||||
break; // ignore bytes 0xef 0xbb 0xbf
|
||||
|
||||
case kINCLUDE:
|
||||
NextItem(tSTRING);
|
||||
sprintf(buf, "%s/../phsource/%s", path_home, item_string);
|
||||
@@ -2914,17 +2798,14 @@ static void CompilePhonemeFiles()
|
||||
f_in = f;
|
||||
strncpy0(current_fname, item_string, sizeof(current_fname));
|
||||
linenum = 1;
|
||||
|
||||
} else
|
||||
error("Missing file: %s", item_string);
|
||||
break;
|
||||
|
||||
case kPHONEMETABLE:
|
||||
EndPhonemeTable();
|
||||
NextItem(tSTRING); // name of the new phoneme table
|
||||
StartPhonemeTable(item_string);
|
||||
break;
|
||||
|
||||
case kPHONEMESTART:
|
||||
if (n_phoneme_tabs == 0) {
|
||||
Error("phonemetable is missing");
|
||||
@@ -2932,15 +2813,12 @@ static void CompilePhonemeFiles()
|
||||
}
|
||||
CompilePhoneme(1);
|
||||
break;
|
||||
|
||||
case kPROCEDURE:
|
||||
CompilePhoneme(0);
|
||||
break;
|
||||
|
||||
case kEQUIVALENTS:
|
||||
CompileEquivalents();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!feof(f_in))
|
||||
Error("Keyword 'phoneme' expected");
|
||||
@@ -2950,8 +2828,6 @@ static void CompilePhonemeFiles()
|
||||
phoneme_tab2[n_phcodes+1].mnemonic = 0; // terminator
|
||||
}
|
||||
|
||||
|
||||
|
||||
static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
||||
{
|
||||
char fname[sizeof(path_home)+40];
|
||||
@@ -3010,7 +2886,6 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
||||
"# Address Data file\n"
|
||||
"# ------- ---------\n");
|
||||
|
||||
|
||||
fprintf(f_errors, "Source data path = '%s/../phsource'\n", path_home);
|
||||
fprintf(f_errors, "Master phonemes file = '%s/../phsource/phonemes'\n", path_home);
|
||||
fprintf(f_errors, "Output to '%s/'\n\n", path_home);
|
||||
@@ -3073,7 +2948,6 @@ static espeak_ng_STATUS CompilePhonemeData2(const char *source, FILE *log)
|
||||
return ENS_OK;
|
||||
}
|
||||
|
||||
|
||||
static const char *preset_tune_names[] = {
|
||||
"s1", "c1", "q1", "e1", NULL
|
||||
};
|
||||
@@ -3113,7 +2987,6 @@ int LookupEnvelopeName(const char *name)
|
||||
return LookupMnem(envelope_names, name);
|
||||
}
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
@@ -3135,7 +3008,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
TUNE *tune_data;
|
||||
TUNE new_tune;
|
||||
|
||||
|
||||
char name[12];
|
||||
char tune_names[N_TUNE_NAMES][12];
|
||||
char buf[sizeof(path_home)+150];
|
||||
@@ -3153,7 +3025,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (ix = 0; preset_tune_names[ix] != NULL; ix++) {
|
||||
strcpy(tune_names[ix], preset_tune_names[ix]);
|
||||
}
|
||||
@@ -3240,7 +3111,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
if (found == 0)
|
||||
error("Bad tune name: '%s;", new_tune.name);
|
||||
break;
|
||||
|
||||
case kENDTUNE:
|
||||
compiling_tune = 0;
|
||||
|
||||
@@ -3254,26 +3124,22 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
}
|
||||
memcpy(&tune_data[tune_number], &new_tune, sizeof(TUNE));
|
||||
break;
|
||||
|
||||
case kTUNE_PREHEAD:
|
||||
new_tune.prehead_start = NextItem(tNUMBER);
|
||||
new_tune.prehead_end = NextItem(tNUMBER);
|
||||
break;
|
||||
|
||||
case kTUNE_ONSET:
|
||||
new_tune.onset = NextItem(tNUMBER);
|
||||
new_tune.unstr_start[0] = NextItem(tSIGNEDNUMBER);
|
||||
new_tune.unstr_end[0] = NextItem(tSIGNEDNUMBER);
|
||||
done_onset = 1;
|
||||
break;
|
||||
|
||||
case kTUNE_HEADLAST:
|
||||
new_tune.head_last = NextItem(tNUMBER);
|
||||
new_tune.unstr_start[2] = NextItem(tSIGNEDNUMBER);
|
||||
new_tune.unstr_end[2] = NextItem(tSIGNEDNUMBER);
|
||||
done_last = 1;
|
||||
break;
|
||||
|
||||
case kTUNE_HEADENV:
|
||||
NextItem(tSTRING);
|
||||
if ((ix = LookupEnvelopeName(item_string)) < 0)
|
||||
@@ -3282,7 +3148,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
new_tune.stressed_env = ix;
|
||||
new_tune.stressed_drop = NextItem(tNUMBER);
|
||||
break;
|
||||
|
||||
case kTUNE_HEAD:
|
||||
new_tune.head_max_steps = NextItem(tNUMBER);
|
||||
new_tune.head_start = NextItem(tNUMBER);
|
||||
@@ -3290,7 +3155,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
new_tune.unstr_start[1] = NextItem(tSIGNEDNUMBER);
|
||||
new_tune.unstr_end[1] = NextItem(tSIGNEDNUMBER);
|
||||
break;
|
||||
|
||||
case kTUNE_HEADEXTEND:
|
||||
// up to 8 numbers
|
||||
for (ix = 0; ix < (int)(sizeof(new_tune.head_extend)); ix++) {
|
||||
@@ -3301,7 +3165,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
}
|
||||
new_tune.n_head_extend = ix; // number of values
|
||||
break;
|
||||
|
||||
case kTUNE_NUCLEUS0:
|
||||
NextItem(tSTRING);
|
||||
if ((ix = LookupEnvelopeName(item_string)) < 0) {
|
||||
@@ -3312,7 +3175,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
new_tune.nucleus0_max = NextItem(tNUMBER);
|
||||
new_tune.nucleus0_min = NextItem(tNUMBER);
|
||||
break;
|
||||
|
||||
case kTUNE_NUCLEUS1:
|
||||
NextItem(tSTRING);
|
||||
if ((ix = LookupEnvelopeName(item_string)) < 0) {
|
||||
@@ -3334,7 +3196,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
new_tune.split_tail_end = new_tune.tail_end;
|
||||
}
|
||||
break;
|
||||
|
||||
case kTUNE_SPLIT:
|
||||
NextItem(tSTRING);
|
||||
if ((ix = LookupEnvelopeName(item_string)) < 0) {
|
||||
@@ -3359,7 +3220,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
else
|
||||
new_tune.split_tune = ix;
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Unexpected: '%s'", item_string);
|
||||
break;
|
||||
@@ -3382,8 +3242,6 @@ espeak_ng_STATUS espeak_ng_CompileIntonation(FILE *log)
|
||||
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
espeak_ng_STATUS espeak_ng_CompilePhonemeData(long rate, FILE *log)
|
||||
{
|
||||
if (!log) log = stderr;
|
||||
|
||||
@@ -94,7 +94,6 @@ MNEM_TAB mnem_flags[] = {
|
||||
{ "$u2+", 0x4e },
|
||||
{ "$u3+", 0x4f },
|
||||
|
||||
|
||||
// these set the corresponding numbered bit if dictionary_flags
|
||||
{ "$pause", 8 }, // ensure pause before this word
|
||||
{ "$strend", 9 }, // full stress if at end of clause
|
||||
@@ -151,7 +150,6 @@ MNEM_TAB mnem_flags[] = {
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
|
||||
#define LEN_GROUP_NAME 12
|
||||
|
||||
typedef struct {
|
||||
@@ -161,7 +159,6 @@ typedef struct {
|
||||
int group3_ix;
|
||||
} RGROUP;
|
||||
|
||||
|
||||
int isspace2(unsigned int c)
|
||||
{
|
||||
// can't use isspace() because on Windows, isspace(0xe1) gives TRUE !
|
||||
@@ -172,8 +169,6 @@ int isspace2(unsigned int c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FILE *fopen_log(const char *fname, const char *access)
|
||||
{
|
||||
// performs fopen, but produces error message to f_log if it fails
|
||||
@@ -186,7 +181,6 @@ static FILE *fopen_log(const char *fname, const char *access)
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
/* Lookup a mnemonic string in a table, return its name */
|
||||
const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
{
|
||||
@@ -198,7 +192,6 @@ const char *LookupMnemName(MNEM_TAB *table, const int value)
|
||||
return ""; /* not found */
|
||||
}
|
||||
|
||||
|
||||
void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len)
|
||||
{
|
||||
int stress;
|
||||
@@ -227,9 +220,6 @@ void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char *DecodeRule(const char *group_chars, int group_length, char *rule, int control)
|
||||
{
|
||||
/* Convert compiled match template to ascii */
|
||||
@@ -384,9 +374,6 @@ char *DecodeRule(const char *group_chars, int group_length, char *rule, int cont
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
{
|
||||
// Compile a line in the language_list file
|
||||
@@ -491,7 +478,6 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
step = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if ((c == '-') && multiple_words) {
|
||||
if (IsDigit09(word[0]))
|
||||
@@ -519,7 +505,6 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (isspace2(c))
|
||||
multiple_words++;
|
||||
@@ -529,21 +514,18 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
step = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (!isspace2(c)) {
|
||||
phonetic = p;
|
||||
step = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (isspace2(c)) {
|
||||
p[0] = 0; /* terminate phonetic */
|
||||
step = 5;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
break;
|
||||
}
|
||||
@@ -660,12 +642,9 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
}
|
||||
dict_line[0] = length;
|
||||
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void compile_dictlist_start(void)
|
||||
{
|
||||
// initialise dictionary list
|
||||
@@ -685,7 +664,6 @@ static void compile_dictlist_start(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void compile_dictlist_end(FILE *f_out)
|
||||
{
|
||||
// Write out the compiled dictionary list
|
||||
@@ -717,8 +695,6 @@ static void compile_dictlist_end(FILE *f_out)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int compile_dictlist_file(const char *path, const char *filename)
|
||||
{
|
||||
int length;
|
||||
@@ -774,8 +750,6 @@ static int compile_dictlist_file(const char *path, const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char rule_cond[80];
|
||||
static char rule_pre[80];
|
||||
static char rule_post[80];
|
||||
@@ -786,8 +760,6 @@ static int group3_ix;
|
||||
|
||||
#define N_RULES 3000 // max rules for each group
|
||||
|
||||
|
||||
|
||||
int isHexDigit(int c)
|
||||
{
|
||||
if ((c >= '0') && (c <= '9'))
|
||||
@@ -799,7 +771,6 @@ int isHexDigit(int c)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void copy_rule_string(char *string, int *state_out)
|
||||
{
|
||||
// state 0: conditional, 1=pre, 2=match, 3=post, 4=phonemes
|
||||
@@ -949,7 +920,6 @@ static void copy_rule_string(char *string, int *state_out)
|
||||
} else
|
||||
output[ix++] = RULE_LETTERGP2;
|
||||
break;
|
||||
|
||||
case '$':
|
||||
value = 0;
|
||||
mr = mnem_rules;
|
||||
@@ -977,9 +947,9 @@ static void copy_rule_string(char *string, int *state_out)
|
||||
error_count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
sxflags |= SUFX_P; // Prefix, now drop through to Suffix
|
||||
// fallthrough
|
||||
case 'S':
|
||||
output[ix++] = RULE_ENDING;
|
||||
value = 0;
|
||||
@@ -1040,8 +1010,6 @@ static void copy_rule_string(char *string, int *state_out)
|
||||
*state_out = next_state[state];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char *compile_rule(char *input)
|
||||
{
|
||||
int ix;
|
||||
@@ -1079,7 +1047,6 @@ static char *compile_rule(char *input)
|
||||
copy_rule_string(buf, &state);
|
||||
p = buf;
|
||||
break;
|
||||
|
||||
case '(': // start of suffix section
|
||||
*p = 0;
|
||||
state = 2;
|
||||
@@ -1091,7 +1058,6 @@ static char *compile_rule(char *input)
|
||||
error_count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case '\n': // end of line
|
||||
case '\r':
|
||||
case 0: // end of line
|
||||
@@ -1099,21 +1065,18 @@ static char *compile_rule(char *input)
|
||||
copy_rule_string(buf, &state);
|
||||
finish = 1;
|
||||
break;
|
||||
|
||||
case '\t': // end of section section
|
||||
case ' ':
|
||||
*p = 0;
|
||||
copy_rule_string(buf, &state);
|
||||
p = buf;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (state == 2)
|
||||
state = 0;
|
||||
else
|
||||
*p++ = c;
|
||||
break;
|
||||
|
||||
default:
|
||||
*p++ = c;
|
||||
break;
|
||||
@@ -1203,7 +1166,6 @@ static char *compile_rule(char *input)
|
||||
return prule;
|
||||
}
|
||||
|
||||
|
||||
int __cdecl string_sorter(char **a, char **b)
|
||||
{
|
||||
char *pa, *pb;
|
||||
@@ -1216,7 +1178,6 @@ int __cdecl string_sorter(char **a, char **b)
|
||||
return strcmp(pa, pb);
|
||||
}
|
||||
|
||||
|
||||
static int __cdecl rgroup_sorter(RGROUP *a, RGROUP *b)
|
||||
{
|
||||
// Sort long names before short names
|
||||
@@ -1228,7 +1189,6 @@ static int __cdecl rgroup_sorter(RGROUP *a, RGROUP *b)
|
||||
return a->start-b->start;
|
||||
}
|
||||
|
||||
|
||||
#ifdef OUTPUT_FORMAT
|
||||
static void print_rule_group(FILE *f_out, int n_rules, char **rules, char *name)
|
||||
{
|
||||
@@ -1330,7 +1290,6 @@ static void print_rule_group(FILE *f_out, int n_rules, char **rules, char *name)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void output_rule_group(FILE *f_out, int n_rules, char **rules, char *name)
|
||||
{
|
||||
int ix;
|
||||
@@ -1389,8 +1348,6 @@ static void output_rule_group(FILE *f_out, int n_rules, char **rules, char *name
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int compile_lettergroup(char *input, FILE *f_out)
|
||||
{
|
||||
char *p;
|
||||
@@ -1463,7 +1420,6 @@ static int compile_lettergroup(char *input, FILE *f_out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
{
|
||||
char *prule;
|
||||
@@ -1600,7 +1556,6 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // .replace
|
||||
{
|
||||
int replace1;
|
||||
@@ -1674,8 +1629,6 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname_err, int flags)
|
||||
{
|
||||
// fname: space to write the filename in case of error
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "synthesize.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
int dictionary_skipwords;
|
||||
char dictionary_name[40];
|
||||
|
||||
@@ -80,10 +79,6 @@ static unsigned char remove_accent[N_REMOVE_ACCENT] = {
|
||||
'a', 'a', 'a', 'b', 'o', 'c', 'd', 'd', 'e', 'e', 'e', 'e', 'e', 'e'
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
void strncpy0(char *to, const char *from, int size)
|
||||
{
|
||||
@@ -93,7 +88,6 @@ void strncpy0(char *to, const char *from, int size)
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
|
||||
int Reverse4Bytes(int word)
|
||||
{
|
||||
// reverse the order of bytes from little-endian to big-endian
|
||||
@@ -111,7 +105,6 @@ int Reverse4Bytes(int word)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int LookupMnem(MNEM_TAB *table, const char *string)
|
||||
{
|
||||
while (table->mnem != NULL) {
|
||||
@@ -122,13 +115,11 @@ int LookupMnem(MNEM_TAB *table, const char *string)
|
||||
return table->value;
|
||||
}
|
||||
|
||||
|
||||
static void InitGroups(Translator *tr)
|
||||
{
|
||||
// Called after dictionary 1 is loaded, to set up table of entry points for translation rule chains
|
||||
// for single-letters and two-letter combinations
|
||||
|
||||
|
||||
int ix;
|
||||
char *p;
|
||||
char *p_name;
|
||||
@@ -206,11 +197,8 @@ static void InitGroups(Translator *tr)
|
||||
p += (strlen(p) + 1);
|
||||
p++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
{
|
||||
int hash;
|
||||
@@ -248,7 +236,6 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
size = fread(tr->data_dictlist, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
|
||||
pw = (int *)(tr->data_dictlist);
|
||||
length = Reverse4Bytes(pw[1]);
|
||||
|
||||
@@ -283,7 +270,6 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Generate a hash code from the specified string
|
||||
This is used to access the dictionary_2 word-lookup dictionary
|
||||
*/
|
||||
@@ -302,8 +288,6 @@ int HashDictionary(const char *string)
|
||||
return (hash+chars) & 0x3ff; // a 10 bit hash code
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Translate a phoneme string from ascii mnemonics to internal phoneme numbers,
|
||||
from 'p' up to next blank .
|
||||
Returns advanced 'p'
|
||||
@@ -343,7 +327,6 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// lookup the phoneme mnemonic, find the phoneme with the highest number of
|
||||
// matching characters
|
||||
@@ -407,8 +390,6 @@ const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DecodePhonemes(const char *inptr, char *outptr)
|
||||
{
|
||||
// Translate from internal phoneme codes into phoneme mnemonics
|
||||
@@ -444,7 +425,6 @@ void DecodePhonemes(const char *inptr, char *outptr)
|
||||
*outptr = 0; /* string terminator */
|
||||
}
|
||||
|
||||
|
||||
// using Kirschenbaum to IPA translation, ascii 0x20 to 0x7f
|
||||
unsigned short ipa1[96] = {
|
||||
0x20, 0x21, 0x22, 0x2b0, 0x24, 0x25, 0x0e6, 0x2c8, 0x28, 0x29, 0x27e, 0x2b, 0x2cc, 0x2d, 0x2e, 0x2f,
|
||||
@@ -459,7 +439,6 @@ unsigned short ipa1[96] = {
|
||||
static char *phon_out_buf = NULL; // passes the result of GetTranslatedPhonemeString()
|
||||
static unsigned int phon_out_size = 0;
|
||||
|
||||
|
||||
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags)
|
||||
{
|
||||
int c;
|
||||
@@ -545,8 +524,6 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
return phon_out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
{
|
||||
/* Called after a clause has been translated into phonemes, in order
|
||||
@@ -594,7 +571,6 @@ const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
use_tie = 0;
|
||||
}
|
||||
|
||||
|
||||
for (ix = 1; ix < (n_phoneme_list-2); ix++) {
|
||||
buf = phon_buf;
|
||||
|
||||
@@ -676,8 +652,6 @@ const char *GetTranslatedPhonemeString(int phoneme_mode)
|
||||
return phon_out_buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int IsLetterGroup(Translator *tr, char *word, int group, int pre)
|
||||
{
|
||||
// match the word against a list of utf-8 strings
|
||||
@@ -710,7 +684,6 @@ static int IsLetterGroup(Translator *tr, char *word, int group, int pre)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int IsLetter(Translator *tr, int letter, int group)
|
||||
{
|
||||
int letter2;
|
||||
@@ -740,15 +713,11 @@ static int IsLetter(Translator *tr, int letter, int group)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int IsVowel(Translator *tr, int letter)
|
||||
{
|
||||
return IsLetter(tr, letter, LETTERGP_VOWEL2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int Unpronouncable2(Translator *tr, char *word)
|
||||
{
|
||||
int c;
|
||||
@@ -765,7 +734,6 @@ static int Unpronouncable2(Translator *tr, char *word)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
{
|
||||
/* Determines whether a word in 'unpronouncable', i.e. whether it should
|
||||
@@ -837,11 +805,8 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
return 1; // no vowel, or no vowel in first few letters
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int GetVowelStress(Translator *tr, unsigned char *phonemes, signed char *vowel_stress, int *vowel_count, int *stressed_syllable, int control)
|
||||
{
|
||||
// control = 1, set stress to 1 for forced unstressed vowels
|
||||
@@ -953,12 +918,9 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, signed char *
|
||||
return max_stress;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char stress_phonemes[] = { phonSTRESS_D, phonSTRESS_U, phonSTRESS_2, phonSTRESS_3,
|
||||
phonSTRESS_P, phonSTRESS_P2, phonSTRESS_TONIC };
|
||||
|
||||
|
||||
void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
{
|
||||
int ix;
|
||||
@@ -1003,8 +965,6 @@ void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
*word = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int control)
|
||||
{
|
||||
/* Guess stress pattern of word. This is language specific
|
||||
@@ -1052,7 +1012,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
|
||||
static char consonant_types[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
/* stress numbers STRESS_BASE +
|
||||
0 diminished, unstressed within a word
|
||||
1 unstressed, weak
|
||||
@@ -1119,14 +1078,13 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (tr->langopts.stress_rule)
|
||||
{
|
||||
case 8:
|
||||
// stress on first syllable, unless it is a light syllable followed by a heavy syllable
|
||||
if ((syllable_weight[1] > 0) || (syllable_weight[2] == 0))
|
||||
break;
|
||||
// else drop through to case 1
|
||||
// fallthrough
|
||||
case 1:
|
||||
// stress on second syllable
|
||||
if ((stressed_syllable == 0) && (vowel_count > 2)) {
|
||||
@@ -1136,7 +1094,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // penultimate, but final if only 1 or 2 syllables
|
||||
if (stressed_syllable == 0) {
|
||||
if (vowel_count < 4) {
|
||||
@@ -1145,7 +1102,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
break;
|
||||
}
|
||||
}
|
||||
// drop through to next case
|
||||
// fallthrough
|
||||
case 2:
|
||||
// a language with stress on penultimate vowel
|
||||
|
||||
@@ -1201,7 +1158,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// stress on last vowel
|
||||
if (stressed_syllable == 0) {
|
||||
@@ -1219,7 +1175,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // stress on antipenultimate vowel
|
||||
if (stressed_syllable == 0) {
|
||||
stressed_syllable = vowel_count - 3;
|
||||
@@ -1231,7 +1186,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// LANG=Russian
|
||||
if (stressed_syllable == 0) {
|
||||
@@ -1253,7 +1207,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // LANG=hi stress on the last heaviest syllable
|
||||
if (stressed_syllable == 0) {
|
||||
int wt;
|
||||
@@ -1281,7 +1234,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: // LANG=tr, the last syllable for any vowel marked explicitly as unstressed
|
||||
if (stressed_syllable == 0) {
|
||||
stressed_syllable = vowel_count - 1;
|
||||
@@ -1295,14 +1247,12 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: // mark all as stressed
|
||||
for (ix = 1; ix < vowel_count; ix++) {
|
||||
if (vowel_stress[ix] < 0)
|
||||
vowel_stress[ix] = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: // LANG=kl (Greenlandic)
|
||||
long_vowel = 0;
|
||||
for (ix = 1; ix < vowel_count; ix++) {
|
||||
@@ -1331,7 +1281,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
vowel_stress[stressed_syllable] = 4;
|
||||
max_stress = 4;
|
||||
break;
|
||||
|
||||
case 13: // LANG=ml, 1st unless 1st vowel is short and 2nd is long
|
||||
if (stressed_syllable == 0) {
|
||||
stressed_syllable = 1;
|
||||
@@ -1358,7 +1307,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
else
|
||||
stress = 3;
|
||||
|
||||
|
||||
if (unstressed_word == 0) {
|
||||
if ((stressflags & S_2_SYL_2) && (vowel_count == 3)) {
|
||||
// Two syllable word, if one syllable has primary stress, then give the other secondary stress
|
||||
@@ -1439,13 +1387,11 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
max_stress = tonic;
|
||||
}
|
||||
|
||||
|
||||
/* produce output phoneme string */
|
||||
p = phonetic;
|
||||
v = 1;
|
||||
|
||||
if (!(control & 1) && ((ph = phoneme_tab[*p]) != NULL)) {
|
||||
|
||||
while ((ph->type == phSTRESS) || (*p == phonEND_WORD)) {
|
||||
p++;
|
||||
ph = phoneme_tab[p[0]];
|
||||
@@ -1536,8 +1482,6 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph)
|
||||
{
|
||||
/* Add new phoneme string "ph" to "string"
|
||||
@@ -1578,8 +1522,6 @@ void AppendPhonemes(Translator *tr, char *string, int size, const char *ph)
|
||||
strcat(string, ph);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void MatchRule(Translator *tr, char *word[], char *word_start, int group_length, char *rule, MatchRecord *match_out, int word_flags, int dict_flags)
|
||||
{
|
||||
/* Checks a specified word against dictionary rules.
|
||||
@@ -1644,7 +1586,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
total_consumed = 0;
|
||||
common_phonemes = NULL;
|
||||
match_type = 0;
|
||||
@@ -1695,13 +1636,11 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
rule--; // so we are still pointing at the 0
|
||||
failed = 2; // matched OK
|
||||
break;
|
||||
|
||||
case RULE_PRE_ATSTART: // pre rule with implied 'start of word'
|
||||
check_atstart = 1;
|
||||
unpron_ignore = 0;
|
||||
match_type = RULE_PRE;
|
||||
break;
|
||||
|
||||
case RULE_PRE:
|
||||
match_type = RULE_PRE;
|
||||
if (word_flags & FLAG_UNPRON_TEST) {
|
||||
@@ -1711,7 +1650,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
failed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_POST:
|
||||
match_type = RULE_POST;
|
||||
break;
|
||||
@@ -1762,8 +1700,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
|
||||
case RULE_POST:
|
||||
/* continue moving fowards */
|
||||
distance_right += 6;
|
||||
@@ -1786,7 +1722,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_LETTERGP2: // match against a list of utf-8 strings
|
||||
letter_group = *rule++ - 'A';
|
||||
if ((n_bytes = IsLetterGroup(tr, post_ptr-1, letter_group, 0)) > 0) {
|
||||
@@ -1795,7 +1730,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_NOTVOWEL:
|
||||
if (IsLetter(tr, letter_w, 0) || ((letter_w == ' ') && (word_flags & FLAG_SUFFIX_VOWEL)))
|
||||
failed = 1;
|
||||
@@ -1804,7 +1738,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
post_ptr += letter_xbytes;
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_DIGIT:
|
||||
if (IsDigit(letter_w)) {
|
||||
add_points = (20-distance_right);
|
||||
@@ -1816,7 +1749,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_NONALPHA:
|
||||
if (!iswalpha2(letter_w)) {
|
||||
add_points = (21-distance_right);
|
||||
@@ -1824,14 +1756,12 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_DOUBLE:
|
||||
if (letter == last_letter)
|
||||
add_points = (21-distance_right);
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_DOLLAR:
|
||||
command = *rule++;
|
||||
if (command == DOLLAR_UNPR)
|
||||
@@ -1864,14 +1794,12 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
failed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if ((letter == '-') || ((letter == ' ') && (word_flags & FLAG_HYPHEN_AFTER)))
|
||||
add_points = (22-distance_right); // one point more than match against space
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_SYLLABLE:
|
||||
{
|
||||
/* more than specified number of vowel letters to the right */
|
||||
@@ -1897,8 +1825,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
else
|
||||
failed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case RULE_NOVOWELS:
|
||||
{
|
||||
char *p = post_ptr + letter_xbytes;
|
||||
@@ -1912,8 +1839,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
if (!failed)
|
||||
add_points = (19-distance_right);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case RULE_SKIPCHARS:
|
||||
{
|
||||
// Used for lang=Tamil, used to match on the next word after an unknown word ending
|
||||
@@ -1930,12 +1856,10 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
if (letter_w == rule_w)
|
||||
post_ptr = p2;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case RULE_INC_SCORE:
|
||||
add_points = 20; // force an increase in points
|
||||
break;
|
||||
|
||||
case RULE_DEL_FWD:
|
||||
// find the next 'e' in the word and replace by 'E'
|
||||
for (p = *word + group_length; p < post_ptr; p++) {
|
||||
@@ -1945,7 +1869,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_ENDING:
|
||||
{
|
||||
int end_type;
|
||||
@@ -1959,15 +1882,13 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
rule += 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case RULE_NO_SUFFIX:
|
||||
if (word_flags & FLAG_SUFFIX_REMOVED)
|
||||
failed = 1; // a suffix has been removed
|
||||
else
|
||||
add_points = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (letter == rb) {
|
||||
if ((letter & 0xc0) != 0x80) {
|
||||
@@ -1979,8 +1900,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case RULE_PRE:
|
||||
/* match backwards from start of current group */
|
||||
distance_left += 2;
|
||||
@@ -2005,7 +1924,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_LETTERGP2: // match against a list of utf-8 strings
|
||||
letter_group = *rule++ - 'A';
|
||||
if ((n_bytes = IsLetterGroup(tr, pre_ptr, letter_group, 1)) > 0) {
|
||||
@@ -2014,7 +1932,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_NOTVOWEL:
|
||||
if (!IsLetter(tr, letter_w, 0)) {
|
||||
add_points = (20-distance_left);
|
||||
@@ -2022,14 +1939,12 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_DOUBLE:
|
||||
if (letter == last_letter)
|
||||
add_points = (21-distance_left);
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_DIGIT:
|
||||
if (IsDigit(letter_w)) {
|
||||
add_points = (21-distance_left);
|
||||
@@ -2037,7 +1952,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_NONALPHA:
|
||||
if (!iswalpha2(letter_w)) {
|
||||
add_points = (21-distance_right);
|
||||
@@ -2045,7 +1959,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
} else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_DOLLAR:
|
||||
command = *rule++;
|
||||
if ((command == DOLLAR_LIST) || ((command & 0xf0) == 0x20)) {
|
||||
@@ -2065,7 +1978,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
failed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_SYLLABLE:
|
||||
/* more than specified number of vowels to the left */
|
||||
syllable_count = 1;
|
||||
@@ -2078,14 +1990,12 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_STRESSED:
|
||||
if (tr->word_stressed_count > 0)
|
||||
add_points = 19;
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_NOVOWELS:
|
||||
{
|
||||
char *p = pre_ptr - letter_xbytes - 1;
|
||||
@@ -2099,22 +2009,19 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
if (!failed)
|
||||
add_points = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case RULE_IFVERB:
|
||||
if (tr->expect_verb)
|
||||
add_points = 1;
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case RULE_CAPITAL:
|
||||
if (word_flags & FLAG_FIRST_UPPER)
|
||||
add_points = 1;
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case '.':
|
||||
// dot in pre- section, match on any dot before this point in the word
|
||||
for (p = pre_ptr; *p != ' '; p--) {
|
||||
@@ -2126,14 +2033,12 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
if (*p == ' ')
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if ((letter == '-') || ((letter == ' ') && (word_flags & FLAG_HYPHEN)))
|
||||
add_points = (22-distance_right); // one point more than match against space
|
||||
else
|
||||
failed = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (letter == rb) {
|
||||
if (letter == RULE_SPACE)
|
||||
@@ -2195,9 +2100,6 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
memcpy(match_out, &best, sizeof(MatchRecord));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, char *end_phonemes, int word_flags, unsigned int *dict_flags)
|
||||
{
|
||||
/* Translate a word bounded by space characters
|
||||
@@ -2239,7 +2141,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
}
|
||||
word_copy[ix] = 0;
|
||||
|
||||
|
||||
if ((option_phonemes & espeakPHONEMES_TRACE) && ((word_flags & FLAG_NO_TRACE) == 0)) {
|
||||
char wordbuf[120];
|
||||
unsigned int ix;
|
||||
@@ -2454,7 +2355,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
{
|
||||
// apply after the translation is complete
|
||||
@@ -2485,8 +2385,6 @@ void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TransposeAlphabet(Translator *tr, char *text)
|
||||
{
|
||||
// transpose cyrillic alphabet (for example) into ascii (single byte) character codes
|
||||
@@ -2508,7 +2406,6 @@ int TransposeAlphabet(Translator *tr, char *text)
|
||||
int bufix;
|
||||
char buf[N_WORD_BYTES+1];
|
||||
|
||||
|
||||
offset = tr->transpose_min - 1;
|
||||
min = tr->transpose_min;
|
||||
max = tr->transpose_max;
|
||||
@@ -2578,9 +2475,6 @@ int TransposeAlphabet(Translator *tr, char *text)
|
||||
return strlen(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Find an entry in the word_dict file for a specified word.
|
||||
Returns NULL if no match, else returns 'word_end'
|
||||
|
||||
@@ -2866,8 +2760,6 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Lookup a specified word in the word dictionary.
|
||||
Returns phonetic data in 'phonetic' and bits in 'flags'
|
||||
|
||||
@@ -2925,7 +2817,6 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
|
||||
found = LookupDict2(tr, word, word1, ph_out, flags, end_flags, wtab);
|
||||
|
||||
|
||||
if (flags[0] & FLAG_MAX3) {
|
||||
if (strcmp(ph_out, tr->phonemes_repeat) == 0) {
|
||||
tr->phonemes_repeat_count++;
|
||||
@@ -2938,7 +2829,6 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
} else
|
||||
tr->phonemes_repeat_count = 0;
|
||||
|
||||
|
||||
if ((found == 0) && (flags[1] & FLAG_ACCENT)) {
|
||||
int letter;
|
||||
word2 = word;
|
||||
@@ -3000,7 +2890,6 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
|
||||
|
||||
int Lookup(Translator *tr, const char *word, char *ph_out)
|
||||
@@ -3030,7 +2919,6 @@ int Lookup(Translator *tr, const char *word, char *ph_out)
|
||||
return flags0;
|
||||
}
|
||||
|
||||
|
||||
int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out)
|
||||
{
|
||||
char buf[100];
|
||||
@@ -3043,8 +2931,6 @@ int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out)
|
||||
return flags[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy)
|
||||
{
|
||||
/* Removes a standard suffix from a word, once it has been indicated by the dictionary rules.
|
||||
|
||||
@@ -346,14 +346,12 @@ int delete_espeak_command(t_espeak_command *the_command)
|
||||
free(the_command->u.my_text.text);
|
||||
}
|
||||
break;
|
||||
|
||||
case ET_MARK:
|
||||
if (the_command->u.my_mark.text)
|
||||
free(the_command->u.my_mark.text);
|
||||
if (the_command->u.my_mark.index_mark)
|
||||
free((void *)(the_command->u.my_mark.index_mark));
|
||||
break;
|
||||
|
||||
case ET_TERMINATED_MSG:
|
||||
{
|
||||
// if the terminated msg is pending,
|
||||
@@ -367,28 +365,23 @@ int delete_espeak_command(t_espeak_command *the_command)
|
||||
sync_espeak_terminated_msg(data->unique_identifier, data->user_data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_KEY:
|
||||
if (the_command->u.my_key.key_name)
|
||||
free((void *)(the_command->u.my_key.key_name));
|
||||
break;
|
||||
|
||||
case ET_CHAR:
|
||||
case ET_PARAMETER:
|
||||
// No allocation
|
||||
break;
|
||||
|
||||
case ET_PUNCTUATION_LIST:
|
||||
if (the_command->u.my_punctuation_list)
|
||||
free((void *)(the_command->u.my_punctuation_list));
|
||||
break;
|
||||
|
||||
case ET_VOICE_NAME:
|
||||
if (the_command->u.my_voice_name)
|
||||
free((void *)(the_command->u.my_voice_name));
|
||||
break;
|
||||
|
||||
case ET_VOICE_SPEC:
|
||||
{
|
||||
espeak_VOICE *data = &(the_command->u.my_voice_spec);
|
||||
@@ -402,8 +395,7 @@ int delete_espeak_command(t_espeak_command *the_command)
|
||||
if (data->identifier)
|
||||
free((void *)data->identifier);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
@@ -434,8 +426,7 @@ void process_espeak_command(t_espeak_command *the_command)
|
||||
data->position, data->position_type,
|
||||
data->end_position, data->flags, data->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_MARK:
|
||||
{
|
||||
t_espeak_mark *data = &(the_command->u.my_mark);
|
||||
@@ -443,57 +434,49 @@ void process_espeak_command(t_espeak_command *the_command)
|
||||
data->index_mark, data->end_position, data->flags,
|
||||
data->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_TERMINATED_MSG:
|
||||
{
|
||||
t_espeak_terminated_msg *data = &(the_command->u.my_terminated_msg);
|
||||
sync_espeak_terminated_msg(data->unique_identifier, data->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_KEY:
|
||||
{
|
||||
const char *data = the_command->u.my_key.key_name;
|
||||
sync_espeak_Key(data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_CHAR:
|
||||
{
|
||||
const wchar_t data = the_command->u.my_char.character;
|
||||
sync_espeak_Char(data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_PARAMETER:
|
||||
{
|
||||
t_espeak_parameter *data = &(the_command->u.my_param);
|
||||
SetParameter(data->parameter, data->value, data->relative);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_PUNCTUATION_LIST:
|
||||
{
|
||||
const wchar_t *data = the_command->u.my_punctuation_list;
|
||||
sync_espeak_SetPunctuationList(data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_VOICE_NAME:
|
||||
{
|
||||
const char *data = the_command->u.my_voice_name;
|
||||
SetVoiceByName(data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_VOICE_SPEC:
|
||||
{
|
||||
espeak_VOICE *data = &(the_command->u.my_voice_spec);
|
||||
SetVoiceByProperties(data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
@@ -518,22 +501,19 @@ void display_espeak_command(t_espeak_command *the_command)
|
||||
t_espeak_text *data = &(the_command->u.my_text);
|
||||
SHOW("display_espeak_command > (0x%x) uid=%d, TEXT=%s, user_data=0x%x\n", the_command, data->unique_identifier, (char *)data->text, (int)(data->user_data));
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_MARK:
|
||||
{
|
||||
t_espeak_mark *data = &(the_command->u.my_mark);
|
||||
SHOW("display_espeak_command > (0x%x) uid=%d, MARK=%s, user_data=0x%x\n", the_command, data->unique_identifier, (char *)data->text, (int)(data->user_data));
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_KEY:
|
||||
{
|
||||
const char *data = the_command->u.my_key.key_name;
|
||||
SHOW("display_espeak_command > (0x%x) KEY=%c\n", the_command, data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_TERMINATED_MSG:
|
||||
{
|
||||
t_espeak_terminated_msg *data = &(the_command->u.my_terminated_msg);
|
||||
@@ -542,44 +522,38 @@ void display_espeak_command(t_espeak_command *the_command)
|
||||
the_command, data->unique_identifier, data->user_data,
|
||||
the_command->state);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_CHAR:
|
||||
{
|
||||
const wchar_t data = the_command->u.my_char.character;
|
||||
SHOW("display_espeak_command > (0x%x) CHAR=%c\n", the_command, (char)data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_PARAMETER:
|
||||
{
|
||||
t_espeak_parameter *data = &(the_command->u.my_param);
|
||||
SHOW("display_espeak_command > (0x%x) PARAMETER=%d, value=%d, relative=%d\n",
|
||||
the_command, data->parameter, data->value, data->relative);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_PUNCTUATION_LIST:
|
||||
{
|
||||
const wchar_t *data = the_command->u.my_punctuation_list;
|
||||
sync_espeak_SetPunctuationList(data);
|
||||
SHOW("display_espeak_command > (0x%x) PUNCTLIST=%s\n", the_command, (char *)data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_VOICE_NAME:
|
||||
{
|
||||
const char *data = the_command->u.my_voice_name;
|
||||
SHOW("display_espeak_command > (0x%x) VOICE_NAME=%s\n", the_command, data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case ET_VOICE_SPEC:
|
||||
{
|
||||
SHOW("display_espeak_command > (0x%x) VOICE_SPEC", the_command);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
|
||||
@@ -54,7 +54,6 @@ enum { MIN_TIMEOUT_IN_MS = 10,
|
||||
ACTIVITY_TIMEOUT = 50, // in ms, check that the stream is active
|
||||
MAX_ACTIVITY_CHECK = 6 };
|
||||
|
||||
|
||||
typedef struct t_node {
|
||||
void *data;
|
||||
struct t_node *next;
|
||||
@@ -190,7 +189,6 @@ static void event_notify(espeak_EVENT *event)
|
||||
my_callback(NULL, 0, events);
|
||||
a_old_uid = event->unique_identifier;
|
||||
break;
|
||||
|
||||
case espeakEVENT_MSG_TERMINATED:
|
||||
case espeakEVENT_MARK:
|
||||
case espeakEVENT_WORD:
|
||||
@@ -207,11 +205,10 @@ static void event_notify(espeak_EVENT *event)
|
||||
my_callback(NULL, 0, events);
|
||||
a_old_uid = event->unique_identifier;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
case espeakEVENT_LIST_TERMINATED:
|
||||
case espeakEVENT_PLAY:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -231,13 +228,11 @@ static int event_delete(espeak_EVENT *event)
|
||||
case espeakEVENT_MSG_TERMINATED:
|
||||
event_notify(event);
|
||||
break;
|
||||
|
||||
case espeakEVENT_MARK:
|
||||
case espeakEVENT_PLAY:
|
||||
if (event->id.name)
|
||||
free((void *)(event->id.name));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "wave.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
// my_mutex: protects my_thread_is_talking,
|
||||
// my_stop_is_required, and the command fifo
|
||||
static pthread_mutex_t my_mutex;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
/* Note this module is mostly old code that needs to be rewritten to
|
||||
provide a more flexible intonation system.
|
||||
*/
|
||||
@@ -55,15 +54,11 @@ typedef struct {
|
||||
|
||||
static SYLLABLE *syllable_tab;
|
||||
|
||||
|
||||
static int tone_pitch_env; /* used to return pitch envelope */
|
||||
|
||||
|
||||
|
||||
/* Pitch data for tone types */
|
||||
/*****************************/
|
||||
|
||||
|
||||
#define PITCHfall 0
|
||||
#define PITCHrise 2
|
||||
#define PITCHfrise 4 // and 3 must be for the variant preceded by 'r'
|
||||
@@ -204,9 +199,6 @@ static unsigned char env_risefallrise[128] = {
|
||||
0x50, 0x5a, 0x64, 0x70, 0x7c, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x93
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned char *envelope_data[N_ENVELOPE_DATA] = {
|
||||
env_fall, env_fall,
|
||||
env_rise, env_rise,
|
||||
@@ -221,8 +213,6 @@ unsigned char *envelope_data[N_ENVELOPE_DATA] = {
|
||||
env_risefallrise, env_risefallrise
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* indexed by stress */
|
||||
static int min_drop[] = { 6, 7, 9, 9, 20, 20, 20, 25 };
|
||||
|
||||
@@ -234,11 +224,9 @@ static signed char oflow[] = { 0, 40, 24, 8, 0 };
|
||||
static signed char oflow_emf[] = { 10, 52, 32, 20, 10 };
|
||||
static signed char oflow_less[] = { 6, 38, 24, 14, 4 };
|
||||
|
||||
|
||||
#define N_TONE_HEAD_TABLE 13
|
||||
#define N_TONE_NUCLEUS_TABLE 13
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char pre_start;
|
||||
unsigned char pre_end;
|
||||
@@ -254,7 +242,6 @@ typedef struct {
|
||||
signed char *overflow;
|
||||
} TONE_HEAD;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char pitch_env0; /* pitch envelope, tonic syllable at end */
|
||||
unsigned char tonic_max0;
|
||||
@@ -306,8 +293,6 @@ static TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = {
|
||||
{ PITCHfall, 70, 18, PITCHfall, 70, 24, NULL, 32, 20, 0 }, // 12 test
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* index by 0=. 1=, 2=?, 3=! 4=none, 5=emphasized */
|
||||
unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS] = {
|
||||
{ 0, 1, 2, 3, 0, 4 },
|
||||
@@ -320,17 +305,14 @@ unsigned char punctuation_to_tone[INTONATION_TYPES][PUNCT_INTONATIONS] = {
|
||||
{ 12, 12, 12, 12, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
int n_tunes = 0;
|
||||
TUNE *tunes = NULL;
|
||||
|
||||
|
||||
#define SECONDARY 3
|
||||
#define PRIMARY 4
|
||||
#define PRIMARY_STRESSED 6
|
||||
#define PRIMARY_LAST 7
|
||||
|
||||
|
||||
static int number_pre;
|
||||
static int number_body;
|
||||
static int number_tail;
|
||||
@@ -339,7 +321,6 @@ static int tone_posn;
|
||||
static int tone_posn2;
|
||||
static int no_tonic;
|
||||
|
||||
|
||||
static void count_pitch_vowels(int start, int end, int clause_end)
|
||||
{
|
||||
int ix;
|
||||
@@ -370,7 +351,6 @@ static void count_pitch_vowels(int start, int end, int clause_end)
|
||||
|
||||
last_primary = ix;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (number_pre < 0)
|
||||
@@ -391,9 +371,6 @@ static void count_pitch_vowels(int start, int end, int clause_end)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Count number of primary stresses up to tonic syllable or body_reset */
|
||||
static int count_increments(int ix, int end_ix, int min_stress)
|
||||
{
|
||||
@@ -411,9 +388,6 @@ static int count_increments(int ix, int end_ix, int min_stress)
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Set the pitch of a vowel in syllable_tab
|
||||
static void set_pitch(SYLLABLE *syl, int base, int drop)
|
||||
{
|
||||
@@ -441,7 +415,6 @@ static void set_pitch(SYLLABLE *syl, int base, int drop)
|
||||
syl->flags |= flags;
|
||||
}
|
||||
|
||||
|
||||
static int CountUnstressed(int start, int end, int limit)
|
||||
{
|
||||
int ix;
|
||||
@@ -521,7 +494,6 @@ static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix, int control)
|
||||
increment = pitch_range / (n_steps -1);
|
||||
else
|
||||
increment = 0;
|
||||
|
||||
} else if (syl_ix == head_final) {
|
||||
// a pitch has been specified for the last primary stress before the nucleus
|
||||
pitch = tune->head_last << 8;
|
||||
@@ -567,11 +539,8 @@ static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix, int control)
|
||||
syl_ix++;
|
||||
}
|
||||
return syl_ix;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Calculate pitches until next RESET or tonic syllable, or end.
|
||||
Increment pitch if stress is >= min_stress.
|
||||
Used for tonic segment */
|
||||
@@ -667,8 +636,6 @@ static int calc_pitch_segment(int ix, int end_ix, TONE_HEAD *th, TONE_NUCLEUS *t
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetPitchGradient(int start_ix, int end_ix, int start_pitch, int end_pitch)
|
||||
{
|
||||
// Set a linear pitch change over a number of syllables.
|
||||
@@ -714,8 +681,6 @@ static void SetPitchGradient(int start_ix, int end_ix, int start_pitch, int end_
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Calculate pitch values for the vowels in this tone group
|
||||
static int calc_pitches2(int start, int end, int tune_number)
|
||||
{
|
||||
@@ -767,8 +732,6 @@ static int calc_pitches2(int start, int end, int tune_number)
|
||||
return tone_pitch_env;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Calculate pitch values for the vowels in this tone group
|
||||
static int calc_pitches(int control, int start, int end, int tune_number)
|
||||
{
|
||||
@@ -833,11 +796,6 @@ static int calc_pitches(int control, int start, int end, int tune_number)
|
||||
return tone_pitch_env;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
{
|
||||
// clause_tone: 0=. 1=, 2=?, 3=! 4=none
|
||||
@@ -883,7 +841,6 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
p->tone_ph = PhonemeCode('7'); // change default tone (tone 1) to falling tone at end of clause
|
||||
}
|
||||
|
||||
|
||||
pause = 1;
|
||||
tone_promoted = 0;
|
||||
|
||||
@@ -915,7 +872,6 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
|
||||
p->tone_ph = tone_ph;
|
||||
tph = phoneme_tab[tone_ph];
|
||||
|
||||
} else
|
||||
tone_promoted = 0;
|
||||
|
||||
@@ -980,12 +936,8 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CalcPitches(Translator *tr, int clause_type)
|
||||
{
|
||||
// clause_type: 0=. 1=, 2=?, 3=! 4=none
|
||||
@@ -1030,14 +982,11 @@ void CalcPitches(Translator *tr, int clause_type)
|
||||
if (n_st == 0)
|
||||
return; // nothing to do
|
||||
|
||||
|
||||
|
||||
if (tr->langopts.tone_language == 1) {
|
||||
CalcPitches_Tone(tr, clause_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
option = tr->langopts.intonation_group;
|
||||
if (option >= INTONATION_TYPES)
|
||||
option = 1;
|
||||
@@ -1132,7 +1081,6 @@ void CalcPitches(Translator *tr, int clause_type)
|
||||
calc_pitches(option, st_start, st_ix, group_tone);
|
||||
}
|
||||
|
||||
|
||||
// unpack pitch data
|
||||
st_ix = 0;
|
||||
for (ix = ph_start; ix < ph_end; ix++) {
|
||||
@@ -1171,5 +1119,4 @@ void CalcPitches(Translator *tr, int clause_type)
|
||||
st_ix++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,14 +47,12 @@ extern WGEN_DATA wdata;
|
||||
static int nsamples;
|
||||
static int sample_count;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define getrandom(min, max) ((rand()%(int)(((max)+1)-(min)))+(min))
|
||||
#else
|
||||
#define getrandom(min, max) ((rand()%(long)(((max)+1)-(min)))+(min))
|
||||
#endif
|
||||
|
||||
|
||||
/* function prototypes for functions private to this file */
|
||||
|
||||
static void flutter(klatt_frame_ptr);
|
||||
@@ -152,8 +150,6 @@ static double resonator2(resonator_ptr r, double input)
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static double antiresonator2(resonator_ptr r, double input)
|
||||
{
|
||||
register double x = (double)r->a * (double)input + (double)r->b * (double)r->p1 + (double)r->c * (double)r->p2;
|
||||
@@ -166,8 +162,6 @@ static double antiresonator2(resonator_ptr r, double input)
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function FLUTTER
|
||||
|
||||
@@ -196,8 +190,6 @@ static void flutter(klatt_frame_ptr frame)
|
||||
time_count++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function SAMPLED_SOURCE
|
||||
|
||||
@@ -245,16 +237,12 @@ static double sampled_source(int source_num)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function PARWAVE
|
||||
|
||||
Converts synthesis parameters to a waveform.
|
||||
*/
|
||||
|
||||
|
||||
static int parwave(klatt_frame_ptr frame)
|
||||
{
|
||||
double temp;
|
||||
@@ -460,10 +448,6 @@ static int parwave(klatt_frame_ptr frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void KlattReset(int control)
|
||||
{
|
||||
int r_ix;
|
||||
@@ -488,7 +472,6 @@ void KlattReset(int control)
|
||||
kt_globals.rsn[r_ix].p1 = 0;
|
||||
kt_globals.rsn[r_ix].p2 = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (r_ix = 0; r_ix <= R6p; r_ix++) {
|
||||
@@ -497,7 +480,6 @@ void KlattReset(int control)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function FRAME_INIT
|
||||
|
||||
@@ -553,7 +535,6 @@ static void frame_init(klatt_frame_ptr frame)
|
||||
kt_globals.rsn[F_NZ].b_inc = (kt_globals.rsn_next[F_NZ].b - kt_globals.rsn[F_NZ].b) / 64.0;
|
||||
kt_globals.rsn[F_NZ].c_inc = (kt_globals.rsn_next[F_NZ].c - kt_globals.rsn[F_NZ].c) / 64.0;
|
||||
|
||||
|
||||
/* Set coefficients of parallel resonators, and amplitude of outputs */
|
||||
|
||||
for (ix = 0; ix <= 6; ix++) {
|
||||
@@ -564,11 +545,8 @@ static void frame_init(klatt_frame_ptr frame)
|
||||
/* output low-pass filter */
|
||||
|
||||
setabc((long)0.0, (long)(kt_globals.samrate/2), &(kt_globals.rsn[Rout]));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function IMPULSIVE_SOURCE
|
||||
|
||||
@@ -578,7 +556,6 @@ static void frame_init(klatt_frame_ptr frame)
|
||||
to Kopen.
|
||||
*/
|
||||
|
||||
|
||||
static double impulsive_source()
|
||||
{
|
||||
static double doublet[] = { 0.0, 13000000.0, -13000000.0 };
|
||||
@@ -592,8 +569,6 @@ static double impulsive_source()
|
||||
return resonator(&(kt_globals.rsn[RGL]), vwave);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function NATURAL_SOURCE
|
||||
|
||||
@@ -617,10 +592,6 @@ static double natural_source()
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function PITCH_SYNC_PAR_RESET
|
||||
|
||||
@@ -708,7 +679,6 @@ static void pitch_synch_par_reset(klatt_frame_ptr frame)
|
||||
kt_globals.nopen = 40;
|
||||
}
|
||||
|
||||
|
||||
/* Reset a & b, which determine shape of "natural" glottal waveform */
|
||||
|
||||
kt_globals.pulse_shape_b = B0[kt_globals.nopen-40];
|
||||
@@ -765,8 +735,6 @@ static void pitch_synch_par_reset(klatt_frame_ptr frame)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function SETABC
|
||||
|
||||
@@ -774,7 +742,6 @@ static void pitch_synch_par_reset(klatt_frame_ptr frame)
|
||||
equation constants.
|
||||
*/
|
||||
|
||||
|
||||
static void setabc(long int f, long int bw, resonator_ptr rp)
|
||||
{
|
||||
double r;
|
||||
@@ -795,7 +762,6 @@ static void setabc(long int f, long int bw, resonator_ptr rp)
|
||||
rp->a = 1.0 - rp->b - rp->c;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function SETZEROABC
|
||||
|
||||
@@ -838,7 +804,6 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function GEN_NOISE
|
||||
|
||||
@@ -847,7 +812,6 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
|
||||
the origin in the z-plane, i.e. output = input + (0.75 * lastoutput)
|
||||
*/
|
||||
|
||||
|
||||
static double gen_noise(double noise)
|
||||
{
|
||||
long temp;
|
||||
@@ -862,7 +826,6 @@ static double gen_noise(double noise)
|
||||
return noise;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function DBTOLIN
|
||||
|
||||
@@ -881,7 +844,6 @@ static double gen_noise(double noise)
|
||||
steps.
|
||||
*/
|
||||
|
||||
|
||||
static double DBtoLIN(long dB)
|
||||
{
|
||||
static short amptable[88] = {
|
||||
@@ -902,10 +864,6 @@ static double DBtoLIN(long dB)
|
||||
return (double)(amptable[dB]) * 0.001;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern voice_t *wvoice;
|
||||
static klatt_peaks_t peaks[N_PEAKS];
|
||||
static int end_wave;
|
||||
@@ -913,9 +871,6 @@ static int klattp[N_KLATTP];
|
||||
static double klattp1[N_KLATTP];
|
||||
static double klattp_inc[N_KLATTP];
|
||||
|
||||
|
||||
|
||||
|
||||
int Wavegen_Klatt(int resume)
|
||||
{
|
||||
int pk;
|
||||
@@ -1005,7 +960,6 @@ int Wavegen_Klatt(int resume)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control)
|
||||
{
|
||||
int ix;
|
||||
@@ -1122,7 +1076,6 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Wavegen_Klatt2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2)
|
||||
{
|
||||
if (resume == 0)
|
||||
@@ -1131,8 +1084,6 @@ int Wavegen_Klatt2(int length, int modulation, int resume, frame_t *fr1, frame_t
|
||||
return Wavegen_Klatt(resume);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KlattInit()
|
||||
{
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "mbrowrap.h"
|
||||
|
||||
|
||||
/*
|
||||
* mbrola instance parameters
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
#define M_LIGATURE 0x8000
|
||||
#define M_NAME 0
|
||||
#define M_SMALLCAP 1
|
||||
@@ -65,7 +64,6 @@
|
||||
#define M_RETROFLEX 20
|
||||
#define M_HOOK 21
|
||||
|
||||
|
||||
#define M_MIDDLE_DOT M_DOT_ABOVE // duplicate of M_DOT_ABOVE
|
||||
#define M_IMPLOSIVE M_HOOK
|
||||
|
||||
@@ -74,7 +72,6 @@ static char *digit_lookup;
|
||||
static int speak_missing_thousands;
|
||||
static int number_control;
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int accent_flags; // bit 0, say before the letter name
|
||||
@@ -108,7 +105,6 @@ static ACCENTS accents_tab[] = {
|
||||
{ "_hok", 0 }, // hook
|
||||
};
|
||||
|
||||
|
||||
#define CAPITAL 0
|
||||
#define LETTER(ch, mod1, mod2) (ch-59)+(mod1 << 6)+(mod2 << 11)
|
||||
#define LIGATURE(ch1, ch2, mod1) (ch1-59)+((ch2-59) << 6)+(mod1 << 12)+M_LIGATURE
|
||||
@@ -130,13 +126,11 @@ static ACCENTS accents_tab[] = {
|
||||
#define L_RTAP 72 // U+27E
|
||||
#define L_RLONG 73 // U+27C
|
||||
|
||||
|
||||
static const short non_ascii_tab[] = {
|
||||
0, 0x3b1, 0x259, 0x25b, 0x3b3, 0x3b9, 0x153, 0x3c9,
|
||||
0x3c6, 0x283, 0x3c5, 0x292, 0x294, 0x27e, 0x27c
|
||||
};
|
||||
|
||||
|
||||
// characters U+00e0 to U+017f
|
||||
static const unsigned short letter_accents_0e0[] = {
|
||||
LETTER('a', M_GRAVE, 0), // U+00e0
|
||||
@@ -299,10 +293,8 @@ static const unsigned short letter_accents_0e0[] = {
|
||||
CAPITAL,
|
||||
LETTER('z', M_CARON, 0),
|
||||
LETTER('s', M_NAME, 0), // long-s // U+17f
|
||||
|
||||
};
|
||||
|
||||
|
||||
// characters U+0250 to U+029F
|
||||
static const unsigned short letter_accents_250[] = {
|
||||
LETTER('a', M_TURNED, 0), // U+250
|
||||
@@ -415,7 +407,6 @@ static int LookupLetter2(Translator *tr, unsigned int letter, char *ph_buf)
|
||||
return ph_buf[0];
|
||||
}
|
||||
|
||||
|
||||
void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
|
||||
{
|
||||
// lookup the character in the accents table
|
||||
@@ -451,14 +442,12 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
|
||||
accent2 = (accent_data >> 11) & 0xf;
|
||||
}
|
||||
|
||||
|
||||
if ((accent1 == 0) && !(accent_data & M_LIGATURE)) {
|
||||
// just a letter name, not an accented character or ligature
|
||||
return;
|
||||
}
|
||||
|
||||
if ((flags1 = Lookup(tr, accents_tab[accent1].name, ph_accent1)) != 0) {
|
||||
|
||||
if (LookupLetter2(tr, basic_letter, ph_letter1) != 0) {
|
||||
if (accent2 != 0) {
|
||||
flags2 = Lookup(tr, accents_tab[accent2].name, ph_accent2);
|
||||
@@ -485,8 +474,6 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_buf1, int control)
|
||||
{
|
||||
// control, bit 0: not the first letter of a word
|
||||
@@ -554,10 +541,8 @@ void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_b
|
||||
dict_flags[0] = 0;
|
||||
dict_flags[1] = 0;
|
||||
SetWordStress(tr, ph_buf1, dict_flags, -1, control & 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// unicode ranges for non-ascii digits 0-9
|
||||
static const int number_ranges[] = {
|
||||
0x660, 0x6f0, // arabic
|
||||
@@ -566,7 +551,6 @@ static const int number_ranges[] = {
|
||||
0
|
||||
}; // these must be in ascending order
|
||||
|
||||
|
||||
int NonAsciiNumber(int letter)
|
||||
{
|
||||
// Change non-ascii digit into ascii digit '0' to '9', (or -1 if not)
|
||||
@@ -654,10 +638,8 @@ static unsigned short derived_letters[] = {
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
||||
static const char *hex_letters[] = { "'e:j", "b'i:", "s'i:", "d'i:", "'i:", "'ef" }; // names, using phonemes available to all languages
|
||||
|
||||
|
||||
int IsSuperscript(int letter)
|
||||
{
|
||||
// is this a subscript or superscript letter ?
|
||||
@@ -673,8 +655,6 @@ int IsSuperscript(int letter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
{
|
||||
// get pronunciation for an isolated letter
|
||||
@@ -797,7 +777,6 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// caution: SetWordStress() etc don't expect phonSWITCH + phoneme table number
|
||||
|
||||
if (ph_buf[0] == 0) {
|
||||
@@ -918,8 +897,6 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars)
|
||||
{
|
||||
// Individual letter names, reduce the stress of some.
|
||||
@@ -971,17 +948,13 @@ void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars)
|
||||
*phonemes = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Numbers
|
||||
|
||||
static char ph_ordinal2[12];
|
||||
static char ph_ordinal2x[12];
|
||||
|
||||
|
||||
static int CheckDotOrdinal(Translator *tr, char *word, char *word_end, WORD_TAB *wtab, int roman)
|
||||
{
|
||||
|
||||
int ordinal = 0;
|
||||
int c2;
|
||||
int nextflags;
|
||||
@@ -1027,7 +1000,6 @@ static int CheckDotOrdinal(Translator *tr, char *word, char *word_end, WORD_TAB
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
|
||||
static int hu_number_e(const char *word, int thousandplex, int value)
|
||||
{
|
||||
// lang-hu: variant form of numbers when followed by hyphen and a suffix starting with 'a' or 'e' (but not a, e, az, ez, azt, ezt, att. ett
|
||||
@@ -1044,8 +1016,6 @@ static int hu_number_e(const char *word, int thousandplex, int value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
{
|
||||
int c;
|
||||
@@ -1123,7 +1093,6 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
if (acc > tr->langopts.max_roman)
|
||||
return 0;
|
||||
|
||||
|
||||
Lookup(tr, "_roman", ph_roman); // precede by "roman" if _rom is defined in *_list
|
||||
p = &ph_out[0];
|
||||
|
||||
@@ -1165,7 +1134,6 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const char *M_Variant(int value)
|
||||
{
|
||||
// returns M, or perhaps MA or MB for some cases
|
||||
@@ -1181,24 +1149,20 @@ static const char *M_Variant(int value)
|
||||
if ((teens == 0) && ((value % 10) == 1))
|
||||
return "1M";
|
||||
break;
|
||||
|
||||
case 2: // lang=cs,sk
|
||||
if ((value >= 2) && (value <= 4))
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 3: // lang=pl
|
||||
if ((teens == 0) && (((value % 10) >= 2) && ((value % 10) <= 4)))
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 4: // lang=lt
|
||||
if ((teens == 1) || ((value % 10) == 0))
|
||||
return "0MB";
|
||||
if ((value % 10) == 1)
|
||||
return "0MA";
|
||||
break;
|
||||
|
||||
case 5: // lang=bs,hr,sr
|
||||
if (teens == 0) {
|
||||
if ((value % 10) == 1)
|
||||
@@ -1211,7 +1175,6 @@ static const char *M_Variant(int value)
|
||||
return "0M";
|
||||
}
|
||||
|
||||
|
||||
static int LookupThousands(Translator *tr, int value, int thousandplex, int thousands_exact, char *ph_out)
|
||||
{
|
||||
// thousands_exact: bit 0 no hundreds,tens,or units, bit 1 ordinal numberr
|
||||
@@ -1301,7 +1264,6 @@ static int LookupThousands(Translator *tr, int value, int thousandplex, int thou
|
||||
return found_value;
|
||||
}
|
||||
|
||||
|
||||
static int LookupNum2(Translator *tr, int value, int thousandplex, const int control, char *ph_out)
|
||||
{
|
||||
// Lookup a 2 digit number
|
||||
@@ -1410,7 +1372,6 @@ static int LookupNum2(Translator *tr, int value, int thousandplex, const int con
|
||||
if (found) {
|
||||
ph_tens[0] = 0;
|
||||
} else {
|
||||
|
||||
if (is_ordinal) {
|
||||
sprintf(string, "_%dX%c", tens, ord_type);
|
||||
if (Lookup(tr, string, ph_tens) != 0) {
|
||||
@@ -1548,7 +1509,6 @@ static int LookupNum2(Translator *tr, int value, int thousandplex, const int con
|
||||
return used_and;
|
||||
}
|
||||
|
||||
|
||||
static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null, int thousandplex, int control)
|
||||
{
|
||||
// Translate a 3 digit number
|
||||
@@ -1709,7 +1669,6 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buf2[0] = 0;
|
||||
|
||||
if ((tensunits != 0) || (suppress_null == 0)) {
|
||||
@@ -1751,7 +1710,6 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool CheckThousandsGroup(char *word, int group_len)
|
||||
{
|
||||
// Is this a group of 3 digits which looks like a thousands group?
|
||||
@@ -1767,7 +1725,6 @@ bool CheckThousandsGroup(char *word, int group_len)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control)
|
||||
{
|
||||
// Number translation with various options
|
||||
@@ -1880,7 +1837,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
ph_append[0] = 0;
|
||||
ph_buf2[0] = 0;
|
||||
|
||||
|
||||
if ((word[0] == '0') && (prev_thousands == 0) && (word[1] != ' ') && (word[1] != tr->langopts.decimal_sep)) {
|
||||
if ((n_digits == 2) && (word[3] == ':') && IsDigit09(word[5]) && isspace(word[7])) {
|
||||
// looks like a time 02:30, omit the leading zero
|
||||
@@ -2020,6 +1976,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
{
|
||||
case NUM_DFRACTION_4:
|
||||
max_decimal_count = 5;
|
||||
// fallthrough
|
||||
case NUM_DFRACTION_2:
|
||||
// French/Polish decimal fraction
|
||||
while (word[n_digits] == '0') {
|
||||
@@ -2034,7 +1991,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
n_digits += decimal_count;
|
||||
}
|
||||
break;
|
||||
|
||||
case NUM_DFRACTION_1: // italian, say "hundredths" if leading zero
|
||||
case NUM_DFRACTION_5: // hungarian, always say "tenths" etc.
|
||||
case NUM_DFRACTION_6: // kazakh, always say "tenths" etc, before the decimal fraction
|
||||
@@ -2053,7 +2009,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
strcat(ph_out, ph_buf);
|
||||
n_digits += decimal_count;
|
||||
break;
|
||||
|
||||
case NUM_DFRACTION_3:
|
||||
// Romanian decimal fractions
|
||||
if ((decimal_count <= 4) && (word[n_digits] != '0')) {
|
||||
@@ -2062,7 +2017,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
n_digits += decimal_count;
|
||||
}
|
||||
break;
|
||||
|
||||
case NUM_DFRACTION_7:
|
||||
// alternative form of decimal fraction digits, except the final digit
|
||||
while (decimal_count-- > 1) {
|
||||
@@ -2113,8 +2067,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control)
|
||||
{
|
||||
if ((option_sayas == SAYAS_DIGITS1) || (wtab[0].flags & FLAG_INDIVIDUAL_DIGITS))
|
||||
|
||||
@@ -32,15 +32,11 @@
|
||||
#include "synthesize.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
const unsigned char pause_phonemes[8] = { 0, phonPAUSE_VSHORT, phonPAUSE_SHORT, phonPAUSE, phonPAUSE_LONG, phonGLOTTALSTOP, phonPAUSE_LONG, phonPAUSE_LONG };
|
||||
|
||||
|
||||
extern int n_ph_list2;
|
||||
extern PHONEME_LIST2 ph_list2[N_PHONEME_LIST]; // first stage of text->phonemes
|
||||
|
||||
|
||||
|
||||
static int SubstitutePhonemes(Translator *tr, PHONEME_LIST *plist_out)
|
||||
{
|
||||
// Copy the phonemes list and perform any substitutions that are required for the
|
||||
@@ -100,11 +96,8 @@ static int SubstitutePhonemes(Translator *tr, PHONEME_LIST *plist_out)
|
||||
return n_plist_out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
{
|
||||
|
||||
int ix = 0;
|
||||
int j;
|
||||
int insert_ph = 0;
|
||||
|
||||
@@ -44,14 +44,12 @@
|
||||
#include <locale.h>
|
||||
#define N_XML_BUF 500
|
||||
|
||||
|
||||
static const char *xmlbase = ""; // base URL from <speak>
|
||||
|
||||
static int namedata_ix = 0;
|
||||
static int n_namedata = 0;
|
||||
char *namedata = NULL;
|
||||
|
||||
|
||||
static FILE *f_input = NULL;
|
||||
static int ungot_char2 = 0;
|
||||
unsigned char *p_textinput;
|
||||
@@ -116,7 +114,6 @@ static const unsigned short punct_chars[] = { ',', '.', '?', '!', ':', ';',
|
||||
|
||||
0 };
|
||||
|
||||
|
||||
// indexed by (entry num. in punct_chars) + 1
|
||||
// bits 0-7 pause x 10mS, bits 12-14 intonation type, bit 15 don't need following space or bracket
|
||||
static const unsigned int punct_attributes[] = { 0,
|
||||
@@ -168,7 +165,6 @@ static const unsigned int punct_attributes[] = { 0,
|
||||
CLAUSE_SEMICOLON, // spare
|
||||
0 };
|
||||
|
||||
|
||||
// stack for language and voice properties
|
||||
// frame 0 is for the defaults, before any ssml tags.
|
||||
typedef struct {
|
||||
@@ -188,7 +184,6 @@ static espeak_VOICE base_voice;
|
||||
static char base_voice_variant_name[40] = { 0 };
|
||||
static char current_voice_id[40] = { 0 };
|
||||
|
||||
|
||||
#define N_PARAM_STACK 20
|
||||
static int n_param_stack;
|
||||
PARAM_STACK param_stack[N_PARAM_STACK];
|
||||
@@ -214,7 +209,6 @@ const int param_defaults[N_SPEECH_PARAM] = {
|
||||
0, // voice type
|
||||
};
|
||||
|
||||
|
||||
// additional Latin characters beyond the ascii character set
|
||||
#define MAX_WALPHA 0x24f
|
||||
// indexed by character - 0x80
|
||||
@@ -284,7 +278,6 @@ static const short wchar_toupper[] = {
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
||||
#ifdef NEED_WCHAR_FUNCTIONS
|
||||
|
||||
// use ctype.h functions for Latin1 (character < 0x100)
|
||||
@@ -421,7 +414,6 @@ float wcstod(const wchar_t *str, wchar_t **tailptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// use internal data for iswalpha up to U+024F
|
||||
// iswalpha() on Windows is unreliable (U+AA, U+BA).
|
||||
int iswalpha2(int c)
|
||||
@@ -513,7 +505,6 @@ static int IsRomanU(unsigned int c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void GetC_unget(int c)
|
||||
{
|
||||
// This is only called with UTF8 input, not wchar input
|
||||
@@ -537,7 +528,6 @@ int Eof(void)
|
||||
return end_of_input;
|
||||
}
|
||||
|
||||
|
||||
static int GetC_get(void)
|
||||
{
|
||||
unsigned int c;
|
||||
@@ -581,7 +571,6 @@ static int GetC_get(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int GetC(void)
|
||||
{
|
||||
// Returns a unicode wide character
|
||||
@@ -660,13 +649,11 @@ static int GetC(void)
|
||||
return c1;
|
||||
}
|
||||
|
||||
|
||||
static void UngetC(int c)
|
||||
{
|
||||
ungot_char = c;
|
||||
}
|
||||
|
||||
|
||||
const char *WordToString2(unsigned int word)
|
||||
{
|
||||
// Convert a language mnemonic word into a string
|
||||
@@ -683,7 +670,6 @@ const char *WordToString2(unsigned int word)
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static const char *LookupSpecial(Translator *tr, const char *string, char *text_out)
|
||||
{
|
||||
unsigned int flags[2];
|
||||
@@ -701,7 +687,6 @@ static const char *LookupSpecial(Translator *tr, const char *string, char *text_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static const char *LookupCharName(Translator *tr, int c, int only)
|
||||
{
|
||||
// Find the phoneme string (in ascii) to speak the name of character c
|
||||
@@ -786,7 +771,6 @@ int Read4Bytes(FILE *f)
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
static int LoadSoundFile(const char *fname, int index)
|
||||
{
|
||||
FILE *f;
|
||||
@@ -862,7 +846,6 @@ static int LoadSoundFile(const char *fname, int index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int LookupSoundicon(int c)
|
||||
{
|
||||
// Find the sound icon number for a punctuation chatacter
|
||||
@@ -880,7 +863,6 @@ static int LookupSoundicon(int c)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int LoadSoundFile2(const char *fname)
|
||||
{
|
||||
// Load a sound file into one of the reserved slots in the sound icon table
|
||||
@@ -907,8 +889,6 @@ static int LoadSoundFile2(const char *fname)
|
||||
return slot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output, int *bufix, int end_clause)
|
||||
{
|
||||
// announce punctuation names
|
||||
@@ -1037,7 +1017,6 @@ static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output
|
||||
// these tags have no effect if they are self-closing, eg. <voice />
|
||||
static char ignore_if_self_closing[] = { 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
static MNEM_TAB ssmltags[] = {
|
||||
{ "speak", SSML_SPEAK },
|
||||
{ "voice", SSML_VOICE },
|
||||
@@ -1075,9 +1054,6 @@ static MNEM_TAB ssmltags[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static const char *VoiceFromStack()
|
||||
{
|
||||
// Use the voice properties from the SSML stack to choose a voice, and switch
|
||||
@@ -1153,8 +1129,6 @@ static const char *VoiceFromStack()
|
||||
return v_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void ProcessParamStack(char *outbuf, int *outix)
|
||||
{
|
||||
// Set the speech parameters from the parameter stack
|
||||
@@ -1165,7 +1139,6 @@ static void ProcessParamStack(char *outbuf, int *outix)
|
||||
int new_parameters[N_SPEECH_PARAM];
|
||||
static char cmd_letter[N_SPEECH_PARAM] = { 0, 'S', 'A', 'P', 'R', 0, 'C', 0, 0, 0, 0, 0, 'F' }; // embedded command letters
|
||||
|
||||
|
||||
for (param = 0; param < N_SPEECH_PARAM; param++)
|
||||
new_parameters[param] = -1;
|
||||
|
||||
@@ -1185,11 +1158,9 @@ static void ProcessParamStack(char *outbuf, int *outix)
|
||||
case espeakPUNCTUATION:
|
||||
option_punctuation = value-1;
|
||||
break;
|
||||
|
||||
case espeakCAPITALS:
|
||||
option_capitals = value;
|
||||
break;
|
||||
|
||||
case espeakRATE:
|
||||
case espeakVOLUME:
|
||||
case espeakPITCH:
|
||||
@@ -1206,7 +1177,6 @@ static void ProcessParamStack(char *outbuf, int *outix)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static PARAM_STACK *PushParamStack(int tag_type)
|
||||
{
|
||||
int ix;
|
||||
@@ -1222,7 +1192,6 @@ static PARAM_STACK *PushParamStack(int tag_type)
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
static void PopParamStack(int tag_type, char *outbuf, int *outix)
|
||||
{
|
||||
// unwind the stack up to and including the previous tag of this type
|
||||
@@ -1241,8 +1210,6 @@ static void PopParamStack(int tag_type, char *outbuf, int *outix)
|
||||
ProcessParamStack(outbuf, outix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
|
||||
{
|
||||
// Gets the value string for an attribute.
|
||||
@@ -1273,7 +1240,6 @@ static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int attrcmp(const wchar_t *string1, const char *string2)
|
||||
{
|
||||
int ix;
|
||||
@@ -1288,7 +1254,6 @@ static int attrcmp(const wchar_t *string1, const char *string2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
|
||||
{
|
||||
int ix;
|
||||
@@ -1300,7 +1265,6 @@ static int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
|
||||
return mtab[ix].value;
|
||||
}
|
||||
|
||||
|
||||
static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
{
|
||||
int value = 0;
|
||||
@@ -1317,8 +1281,6 @@ static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int attrcopy_utf8(char *buf, const wchar_t *pw, int len)
|
||||
{
|
||||
// Convert attribute string into utf8, write to buf, and return its utf8 length
|
||||
@@ -1340,8 +1302,6 @@ static int attrcopy_utf8(char *buf, const wchar_t *pw, int len)
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out)
|
||||
{
|
||||
int sign = 0;
|
||||
@@ -1395,7 +1355,6 @@ static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out)
|
||||
return sign; // -1, 0, or 1
|
||||
}
|
||||
|
||||
|
||||
int AddNameData(const char *name, int wide)
|
||||
{
|
||||
// Add the name to the namedata and return its position
|
||||
@@ -1424,7 +1383,6 @@ int AddNameData(const char *name, int wide)
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
void SetVoiceStack(espeak_VOICE *v, const char *variant_name)
|
||||
{
|
||||
SSML_STACK *sp;
|
||||
@@ -1448,7 +1406,6 @@ void SetVoiceStack(espeak_VOICE *v, const char *variant_name)
|
||||
memcpy(&base_voice, ¤t_voice_selected, sizeof(base_voice));
|
||||
}
|
||||
|
||||
|
||||
static int GetVoiceAttributes(wchar_t *pw, int tag_type)
|
||||
{
|
||||
// Determines whether voice attribute are specified in this tag, and if so, whether this means
|
||||
@@ -1519,7 +1476,6 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
|
||||
{
|
||||
int value;
|
||||
@@ -1570,7 +1526,6 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
|
||||
NULL, mnem_rate, mnem_volume, mnem_pitch, mnem_range
|
||||
};
|
||||
|
||||
|
||||
if ((value = attrlookup(attr1, mnem_tabs[param_type])) >= 0) {
|
||||
// mnemonic specifies a value as a percentage of the base pitch/range/rate/volume
|
||||
sp->parameter[param_type] = (param_stack[0].parameter[param_type] * value)/100;
|
||||
@@ -1589,7 +1544,6 @@ static void SetProsodyParameter(int param_type, wchar_t *attr1, PARAM_STACK *sp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int ReplaceKeyName(char *outbuf, int index, int *outix)
|
||||
{
|
||||
// Replace some key-names by single characters, so they can be pronounced in different languages
|
||||
@@ -1615,7 +1569,6 @@ static int ReplaceKeyName(char *outbuf, int index, int *outix)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, int self_closing)
|
||||
{
|
||||
// xml_buf is the tag and attributes with a zero terminator in place of the original '>'
|
||||
@@ -1722,7 +1675,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
voice_change_flag = 0;
|
||||
terminator = CLAUSE_NONE;
|
||||
ssml_sp = &ssml_stack[n_ssml_stack-1];
|
||||
@@ -1744,7 +1696,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
ProcessParamStack(outbuf, outix);
|
||||
break;
|
||||
|
||||
case SSML_PROSODY:
|
||||
sp = PushParamStack(tag_type);
|
||||
|
||||
@@ -1756,7 +1707,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
|
||||
ProcessParamStack(outbuf, outix);
|
||||
break;
|
||||
|
||||
case SSML_EMPHASIS:
|
||||
sp = PushParamStack(tag_type);
|
||||
value = 3; // default is "moderate"
|
||||
@@ -1776,13 +1726,11 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
ProcessParamStack(outbuf, outix);
|
||||
break;
|
||||
|
||||
case SSML_STYLE + SSML_CLOSE:
|
||||
case SSML_PROSODY + SSML_CLOSE:
|
||||
case SSML_EMPHASIS + SSML_CLOSE:
|
||||
PopParamStack(tag_type, outbuf, outix);
|
||||
break;
|
||||
|
||||
case SSML_PHONEME:
|
||||
attr1 = GetSsmlAttribute(px, "alphabet");
|
||||
attr2 = GetSsmlAttribute(px, "ph");
|
||||
@@ -1795,7 +1743,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
outbuf[(*outix)++] = ']';
|
||||
}
|
||||
break;
|
||||
|
||||
case SSML_SAYAS:
|
||||
attr1 = GetSsmlAttribute(px, "interpret-as");
|
||||
attr2 = GetSsmlAttribute(px, "format");
|
||||
@@ -1821,7 +1768,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
sayas_start = *outix;
|
||||
sayas_mode = value; // punctuation doesn't end clause during SAY-AS
|
||||
break;
|
||||
|
||||
case SSML_SAYAS + SSML_CLOSE:
|
||||
if (sayas_mode == SAYAS_KEY) {
|
||||
outbuf[*outix] = 0;
|
||||
@@ -1832,7 +1778,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
outbuf[(*outix)++] = 'Y';
|
||||
sayas_mode = 0;
|
||||
break;
|
||||
|
||||
case SSML_SUB:
|
||||
if ((attr1 = GetSsmlAttribute(px, "alias")) != NULL) {
|
||||
// use the alias rather than the text
|
||||
@@ -1840,16 +1785,13 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
*outix += attrcopy_utf8(&outbuf[*outix], attr1, n_outbuf-*outix);
|
||||
}
|
||||
break;
|
||||
|
||||
case SSML_IGNORE_TEXT:
|
||||
ignore_text = 1;
|
||||
break;
|
||||
|
||||
case SSML_SUB + SSML_CLOSE:
|
||||
case SSML_IGNORE_TEXT + SSML_CLOSE:
|
||||
ignore_text = 0;
|
||||
break;
|
||||
|
||||
case SSML_MARK:
|
||||
if ((attr1 = GetSsmlAttribute(px, "name")) != NULL) {
|
||||
// add name to circular buffer of marker names
|
||||
@@ -1869,7 +1811,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SSML_AUDIO:
|
||||
sp = PushParamStack(tag_type);
|
||||
|
||||
@@ -1908,12 +1849,10 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
else
|
||||
audio_text = 1;
|
||||
return CLAUSE_NONE;
|
||||
|
||||
case SSML_AUDIO + SSML_CLOSE:
|
||||
PopParamStack(tag_type, outbuf, outix);
|
||||
audio_text = 0;
|
||||
return CLAUSE_NONE;
|
||||
|
||||
case SSML_BREAK:
|
||||
value = 21;
|
||||
terminator = CLAUSE_NONE;
|
||||
@@ -1952,7 +1891,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
return terminator + value;
|
||||
}
|
||||
break;
|
||||
|
||||
case SSML_SPEAK:
|
||||
if ((attr1 = GetSsmlAttribute(px, "xml:base")) != NULL) {
|
||||
attrcopy_utf8(buf, attr1, sizeof(buf));
|
||||
@@ -1962,18 +1900,15 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
if (GetVoiceAttributes(px, tag_type) == 0)
|
||||
return 0; // no voice change
|
||||
return CLAUSE_VOICE;
|
||||
|
||||
case SSML_VOICE:
|
||||
if (GetVoiceAttributes(px, tag_type) == 0)
|
||||
return 0; // no voice change
|
||||
return CLAUSE_VOICE;
|
||||
|
||||
case SSML_SPEAK + SSML_CLOSE:
|
||||
// unwind stack until the previous <voice> or <speak> tag
|
||||
while ((n_ssml_stack > 1) && (ssml_stack[n_ssml_stack-1].tag_type != SSML_SPEAK))
|
||||
n_ssml_stack--;
|
||||
return CLAUSE_PERIOD + GetVoiceAttributes(px, tag_type);
|
||||
|
||||
case SSML_VOICE + SSML_CLOSE:
|
||||
// unwind stack until the previous <voice> or <speak> tag
|
||||
while ((n_ssml_stack > 1) && (ssml_stack[n_ssml_stack-1].tag_type != SSML_VOICE))
|
||||
@@ -1981,11 +1916,9 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
|
||||
terminator = 0; // ?? Sentence intonation, but no pause ??
|
||||
return terminator + GetVoiceAttributes(px, tag_type);
|
||||
|
||||
case HTML_BREAK:
|
||||
case HTML_BREAK + SSML_CLOSE:
|
||||
return CLAUSE_COLON;
|
||||
|
||||
case SSML_SENTENCE:
|
||||
if (ssml_sp->tag_type == SSML_SENTENCE) {
|
||||
// new sentence implies end-of-sentence
|
||||
@@ -1993,8 +1926,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
voice_change_flag |= GetVoiceAttributes(px, tag_type);
|
||||
return CLAUSE_PARAGRAPH + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_PARAGRAPH:
|
||||
if (ssml_sp->tag_type == SSML_SENTENCE) {
|
||||
// new paragraph implies end-of-sentence or end-of-paragraph
|
||||
@@ -2006,16 +1937,12 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
}
|
||||
voice_change_flag |= GetVoiceAttributes(px, tag_type);
|
||||
return CLAUSE_PARAGRAPH + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_SENTENCE + SSML_CLOSE:
|
||||
if (ssml_sp->tag_type == SSML_SENTENCE) {
|
||||
// end of a sentence which specified a language
|
||||
voice_change_flag = GetVoiceAttributes(px, tag_type);
|
||||
}
|
||||
return CLAUSE_PERIOD + voice_change_flag;
|
||||
|
||||
|
||||
case SSML_PARAGRAPH + SSML_CLOSE:
|
||||
if ((ssml_sp->tag_type == SSML_SENTENCE) || (ssml_sp->tag_type == SSML_PARAGRAPH)) {
|
||||
// End of a paragraph which specified a language.
|
||||
@@ -2027,7 +1954,6 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void RemoveChar(char *p)
|
||||
{
|
||||
// Replace a UTF-8 character by spaces
|
||||
@@ -2036,7 +1962,6 @@ static void RemoveChar(char *p)
|
||||
memset(p, ' ', utf8_in(&c, p));
|
||||
}
|
||||
|
||||
|
||||
static MNEM_TAB xml_char_mnemonics[] = {
|
||||
{ "gt", '>' },
|
||||
{ "lt", 0xe000 + '<' }, // private usage area, to avoid confusion with XML tag
|
||||
@@ -2047,7 +1972,6 @@ static MNEM_TAB xml_char_mnemonics[] = {
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
|
||||
int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix_top, int n_buf, int *tone_type, char *voice_change)
|
||||
{
|
||||
/* Find the end of the current clause.
|
||||
@@ -2612,7 +2536,6 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
return CLAUSE_EOF; // end of file
|
||||
}
|
||||
|
||||
|
||||
void InitNamedata(void)
|
||||
{
|
||||
namedata_ix = 0;
|
||||
@@ -2623,7 +2546,6 @@ void InitNamedata(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InitText2(void)
|
||||
{
|
||||
int param;
|
||||
|
||||
@@ -37,7 +37,6 @@ extern int GetAmplitude(void);
|
||||
extern void DoSonicSpeed(int value);
|
||||
extern int saved_parameters[];
|
||||
|
||||
|
||||
// convert from words-per-minute to internal speed factor
|
||||
// Use this to calibrate speed for wpm 80-350
|
||||
static unsigned char speed_lookup[] = {
|
||||
@@ -99,7 +98,6 @@ static unsigned char speed_lookup[] = {
|
||||
9, 9, 8, 8, 8, // 355
|
||||
};
|
||||
|
||||
|
||||
// speed_factor1 adjustments for speeds 350 to 374: pauses
|
||||
static unsigned char pause_factor_350[] = {
|
||||
22, 22, 22, 22, 22, 22, 22, 21, 21, 21, // 350
|
||||
@@ -137,8 +135,6 @@ static int speed1 = 130;
|
||||
static int speed2 = 121;
|
||||
static int speed3 = 118;
|
||||
|
||||
|
||||
|
||||
#if HAVE_SONIC_H
|
||||
|
||||
void SetSpeed(int control)
|
||||
@@ -396,44 +392,35 @@ void SetParameter(int parameter, int value, int relative)
|
||||
embedded_value[EMBED_S2] = new_value;
|
||||
SetSpeed(3);
|
||||
break;
|
||||
|
||||
case espeakVOLUME:
|
||||
embedded_value[EMBED_A] = new_value;
|
||||
GetAmplitude();
|
||||
break;
|
||||
|
||||
case espeakPITCH:
|
||||
if (new_value > 99) new_value = 99;
|
||||
if (new_value < 0) new_value = 0;
|
||||
embedded_value[EMBED_P] = new_value;
|
||||
break;
|
||||
|
||||
case espeakRANGE:
|
||||
if (new_value > 99) new_value = 99;
|
||||
embedded_value[EMBED_R] = new_value;
|
||||
break;
|
||||
|
||||
case espeakLINELENGTH:
|
||||
option_linelength = new_value;
|
||||
break;
|
||||
|
||||
case espeakWORDGAP:
|
||||
option_wordgap = new_value;
|
||||
break;
|
||||
|
||||
case espeakINTONATION:
|
||||
if ((new_value & 0xff) != 0)
|
||||
translator->langopts.intonation_group = new_value & 0xff;
|
||||
option_tone_flags = new_value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void DoEmbedded2(int *embix)
|
||||
{
|
||||
// There were embedded commands in the text at this point
|
||||
@@ -451,7 +438,6 @@ static void DoEmbedded2(int *embix)
|
||||
} while ((word & 0x80) == 0);
|
||||
}
|
||||
|
||||
|
||||
void CalcLengths(Translator *tr)
|
||||
{
|
||||
int ix;
|
||||
@@ -503,7 +489,6 @@ void CalcLengths(Translator *tr)
|
||||
case phPAUSE:
|
||||
last_pitch = 0;
|
||||
break;
|
||||
|
||||
case phSTOP:
|
||||
last_pitch = 0;
|
||||
if (prev->type == phFRICATIVE)
|
||||
@@ -525,7 +510,6 @@ void CalcLengths(Translator *tr)
|
||||
if (p->synthflags & SFLAG_LENGTHEN)
|
||||
p->prepause += tr->langopts.long_stop;
|
||||
break;
|
||||
|
||||
case phVFRICATIVE:
|
||||
case phFRICATIVE:
|
||||
if (p->newword) {
|
||||
@@ -558,7 +542,6 @@ void CalcLengths(Translator *tr)
|
||||
p->length = (255 + prev->length)/2;
|
||||
}
|
||||
break;
|
||||
|
||||
case phVSTOP:
|
||||
if (prev->type == phVFRICATIVE || prev->type == phFRICATIVE || (prev->ph->phflags & phSIBILANT) || (prev->type == phLIQUID))
|
||||
p->prepause = 30;
|
||||
@@ -589,9 +572,7 @@ void CalcLengths(Translator *tr)
|
||||
}
|
||||
if ((tr->langopts.word_gap & 0x10) && (p->newword) && (p->prepause < 20))
|
||||
p->prepause = 20;
|
||||
|
||||
break;
|
||||
|
||||
case phLIQUID:
|
||||
case phNASAL:
|
||||
p->amp = tr->stress_amps[0]; // unless changed later
|
||||
@@ -638,7 +619,6 @@ void CalcLengths(Translator *tr)
|
||||
pre_voiced = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case phVOWEL:
|
||||
min_drop = 0;
|
||||
next2 = &phoneme_list[ix+2];
|
||||
@@ -740,7 +720,6 @@ void CalcLengths(Translator *tr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((end_of_clause == 2) && !(tr->langopts.stress_flags & S_NO_EOC_LENGTHEN)) {
|
||||
// this is the last syllable in the clause, lengthen it - more for short vowels
|
||||
len = (p->ph->std_length * 2);
|
||||
|
||||
@@ -79,14 +79,12 @@ int (*phoneme_callback)(const char *) = NULL;
|
||||
char path_home[N_PATH_HOME]; // this is the espeak-data directory
|
||||
extern int saved_parameters[N_SPEECH_PARAM]; // Parameters saved on synthesis start
|
||||
|
||||
|
||||
void WVoiceChanged(voice_t *wvoice)
|
||||
{
|
||||
// Voice change in wavegen
|
||||
voice_samplerate = wvoice->samplerate;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_ASYNC
|
||||
|
||||
static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
|
||||
@@ -150,13 +148,11 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
|
||||
a_wave_can_be_played = fifo_is_command_enabled();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case AUDIO_OUTPUT_RETRIEVAL:
|
||||
if (synth_callback)
|
||||
synth_callback(outbuf, length, event);
|
||||
break;
|
||||
|
||||
case AUDIO_OUTPUT_SYNCHRONOUS:
|
||||
case AUDIO_OUTPUT_SYNCH_PLAYBACK:
|
||||
break;
|
||||
@@ -170,8 +166,6 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
|
||||
return a_wave_can_be_played == 0; // 1 = stop synthesis, -1 = error
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int create_events(short *outbuf, int length, espeak_EVENT *event, uint32_t the_write_pos)
|
||||
{
|
||||
int finished;
|
||||
@@ -204,7 +198,6 @@ static int create_events(short *outbuf, int length, espeak_EVENT *event, uint32_
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
||||
int sync_espeak_terminated_msg(uint32_t unique_identifier, void *user_data)
|
||||
{
|
||||
ENTER("sync_espeak_terminated_msg");
|
||||
@@ -237,7 +230,6 @@ int sync_espeak_terminated_msg(uint32_t unique_identifier, void *user_data)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void select_output(espeak_AUDIO_OUTPUT output_type)
|
||||
{
|
||||
my_mode = output_type;
|
||||
@@ -252,14 +244,11 @@ static void select_output(espeak_AUDIO_OUTPUT output_type)
|
||||
// wave_init() is now called just before the first wave_write()
|
||||
synchronous_mode = 0;
|
||||
break;
|
||||
|
||||
case AUDIO_OUTPUT_RETRIEVAL:
|
||||
synchronous_mode = 0;
|
||||
break;
|
||||
|
||||
case AUDIO_OUTPUT_SYNCHRONOUS:
|
||||
break;
|
||||
|
||||
case AUDIO_OUTPUT_SYNCH_PLAYBACK:
|
||||
option_waveout = 0;
|
||||
WavegenInitSound();
|
||||
@@ -267,9 +256,6 @@ static void select_output(espeak_AUDIO_OUTPUT output_type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
int GetFileLength(const char *filename)
|
||||
{
|
||||
@@ -285,7 +271,6 @@ int GetFileLength(const char *filename)
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
|
||||
char *Alloc(int size)
|
||||
{
|
||||
char *p;
|
||||
@@ -300,8 +285,6 @@ void Free(void *ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void init_path(const char *path)
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
@@ -329,7 +312,6 @@ static void init_path(const char *path)
|
||||
RegQueryValueExA(RegKey, "path", 0, &var_type, buf, &size);
|
||||
|
||||
sprintf(path_home, "%s\\espeak-data", buf);
|
||||
|
||||
#else
|
||||
char *env;
|
||||
|
||||
@@ -381,7 +363,6 @@ static int initialise(int control)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text, int flags)
|
||||
{
|
||||
// Fill the buffer with output sound
|
||||
@@ -511,7 +492,6 @@ static const char *label[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr)
|
||||
{
|
||||
// type: 1=word, 2=sentence, 3=named mark, 4=play audio, 5=end, 7=phoneme
|
||||
@@ -551,14 +531,10 @@ void MarkerEvent(int type, unsigned int char_position, int value, int value2, un
|
||||
ep->id.number = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text, size_t size,
|
||||
unsigned int position, espeak_POSITION_TYPE position_type,
|
||||
unsigned int end_position, unsigned int flags, void *user_data)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
ENTER("sync_espeak_Synth");
|
||||
SHOW("sync_espeak_Synth > position=%d, position_type=%d, end_position=%d, flags=%d, user_data=0x%x, text=%s\n", position, position_type, end_position, flags, user_data, text);
|
||||
@@ -578,11 +554,9 @@ espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text,
|
||||
case POS_CHARACTER:
|
||||
skip_characters = position;
|
||||
break;
|
||||
|
||||
case POS_WORD:
|
||||
skip_words = position;
|
||||
break;
|
||||
|
||||
case POS_SENTENCE:
|
||||
skip_sentences = position;
|
||||
break;
|
||||
@@ -602,9 +576,6 @@ espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text,
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *text, size_t size,
|
||||
const char *index_mark, unsigned int end_position,
|
||||
unsigned int flags, void *user_data)
|
||||
@@ -623,15 +594,12 @@ espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *
|
||||
|
||||
end_character_position = end_position;
|
||||
|
||||
|
||||
aStatus = Synthesize(unique_identifier, text, flags | espeakSSML);
|
||||
SHOW_TIME("LEAVE sync_espeak_Synth_Mark");
|
||||
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void sync_espeak_Key(const char *key)
|
||||
{
|
||||
// symbolic name, symbolicname_character - is there a system resource of symbolic names per language?
|
||||
@@ -650,7 +618,6 @@ void sync_espeak_Key(const char *key)
|
||||
Synthesize(0, key, 0); // speak key as a text string
|
||||
}
|
||||
|
||||
|
||||
void sync_espeak_Char(wchar_t character)
|
||||
{
|
||||
// is there a system resource of character names per language?
|
||||
@@ -662,8 +629,6 @@ void sync_espeak_Char(wchar_t character)
|
||||
Synthesize(0, buf, espeakSSML);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void sync_espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
{
|
||||
// Set the list of punctuation which are spoken for "some".
|
||||
@@ -677,12 +642,8 @@ void sync_espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
|
||||
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback *SynthCallback)
|
||||
{
|
||||
ENTER("espeak_SetSynthCallback");
|
||||
@@ -698,7 +659,6 @@ ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char *, cons
|
||||
uri_callback = UriCallback;
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API void espeak_SetPhonemeCallback(int (*PhonemeCallback)(const char *))
|
||||
{
|
||||
phoneme_callback = PhonemeCallback;
|
||||
@@ -768,8 +728,6 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
|
||||
return samplerate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Synth(const void *text, size_t size,
|
||||
unsigned int position,
|
||||
espeak_POSITION_TYPE position_type,
|
||||
@@ -818,13 +776,10 @@ ESPEAK_API espeak_ERROR espeak_Synth(const void *text, size_t size,
|
||||
delete_espeak_command(c1);
|
||||
delete_espeak_command(c2);
|
||||
}
|
||||
|
||||
#endif
|
||||
return a_error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text, size_t size,
|
||||
const char *index_mark,
|
||||
unsigned int end_position,
|
||||
@@ -843,7 +798,6 @@ ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text, size_t size,
|
||||
if (f_logespeak)
|
||||
fprintf(f_logespeak, "\nSYNTH MARK %s posn %d flags 0x%x\n%s\n", index_mark, end_position, flags, (const char *)text);
|
||||
|
||||
|
||||
if (unique_identifier == NULL)
|
||||
unique_identifier = &temp_identifier;
|
||||
*unique_identifier = 0;
|
||||
@@ -874,13 +828,10 @@ ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text, size_t size,
|
||||
delete_espeak_command(c1);
|
||||
delete_espeak_command(c2);
|
||||
}
|
||||
|
||||
#endif
|
||||
return a_error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Key(const char *key)
|
||||
{
|
||||
ENTER("espeak_Key");
|
||||
@@ -901,12 +852,10 @@ ESPEAK_API espeak_ERROR espeak_Key(const char *key)
|
||||
a_error = fifo_add_command(c);
|
||||
if (a_error != EE_OK)
|
||||
delete_espeak_command(c);
|
||||
|
||||
#endif
|
||||
return a_error;
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character)
|
||||
{
|
||||
ENTER("espeak_Char");
|
||||
@@ -934,7 +883,6 @@ ESPEAK_API espeak_ERROR espeak_Char(wchar_t character)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
{
|
||||
ENTER("espeak_SetVoiceByName");
|
||||
@@ -942,8 +890,6 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
return SetVoiceByName(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
{
|
||||
ENTER("espeak_SetVoiceByProperties");
|
||||
@@ -951,7 +897,6 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_selector
|
||||
return SetVoiceByProperties(voice_selector);
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current)
|
||||
{
|
||||
ENTER("espeak_GetParameter");
|
||||
@@ -961,7 +906,6 @@ ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current)
|
||||
return param_defaults[parameter];
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative)
|
||||
{
|
||||
ENTER("espeak_SetParameter");
|
||||
@@ -988,7 +932,6 @@ ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int valu
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
{
|
||||
ENTER("espeak_SetPunctuationList");
|
||||
@@ -1013,7 +956,6 @@ ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API void espeak_SetPhonemeTrace(int phonememode, FILE *stream)
|
||||
{
|
||||
ENTER("espeak_SetPhonemes");
|
||||
@@ -1033,10 +975,8 @@ ESPEAK_API void espeak_SetPhonemeTrace(int phonememode, FILE *stream)
|
||||
f_trans = stream;
|
||||
if (stream == NULL)
|
||||
f_trans = stderr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
|
||||
{
|
||||
/* phoneme_mode
|
||||
@@ -1050,14 +990,12 @@ ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode,
|
||||
return GetTranslatedPhonemeString(phonememode);
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
|
||||
{
|
||||
ENTER("espeak_CompileDictionary");
|
||||
CompileDictionary(path, dictionary_name, log, NULL, flags);
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Cancel(void)
|
||||
{
|
||||
#ifdef USE_ASYNC
|
||||
@@ -1077,7 +1015,6 @@ ESPEAK_API espeak_ERROR espeak_Cancel(void)
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API int espeak_IsPlaying(void)
|
||||
{
|
||||
#ifdef USE_ASYNC
|
||||
@@ -1090,7 +1027,6 @@ ESPEAK_API int espeak_IsPlaying(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Synchronize(void)
|
||||
{
|
||||
espeak_ERROR berr = err;
|
||||
@@ -1104,7 +1040,6 @@ ESPEAK_API espeak_ERROR espeak_Synchronize(void)
|
||||
return berr;
|
||||
}
|
||||
|
||||
|
||||
extern void FreePhData(void);
|
||||
extern void FreeVoiceList(void);
|
||||
|
||||
@@ -1121,7 +1056,6 @@ ESPEAK_API espeak_ERROR espeak_Terminate(void)
|
||||
wave_terminate();
|
||||
out_samplerate = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
Free(event_list);
|
||||
event_list = NULL;
|
||||
|
||||
@@ -96,7 +96,6 @@ float polint(float xa[], float ya[], int n, float x)
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static SpectFrame *SpectFrameCreate()
|
||||
{
|
||||
int ix;
|
||||
@@ -138,8 +137,6 @@ static void SpectFrameDestroy(SpectFrame *frame)
|
||||
free(frame);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LoadFrame(SpectFrame *frame, FILE *stream, int file_format_type)
|
||||
{
|
||||
short ix;
|
||||
@@ -199,8 +196,6 @@ int LoadFrame(SpectFrame *frame, FILE *stream, int file_format_type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double GetFrameRms(SpectFrame *frame, int seq_amplitude)
|
||||
{
|
||||
int h;
|
||||
@@ -226,7 +221,6 @@ double GetFrameRms(SpectFrame *frame, int seq_amplitude)
|
||||
return frame->rms;
|
||||
}
|
||||
|
||||
|
||||
SpectSeq *SpectSeqCreate()
|
||||
{
|
||||
SpectSeq *spect = malloc(sizeof(SpectSeq));
|
||||
@@ -263,7 +257,6 @@ void SpectSeqDestroy(SpectSeq *spect)
|
||||
free(spect);
|
||||
}
|
||||
|
||||
|
||||
static float GetFrameLength(SpectSeq *spect, int frame)
|
||||
{
|
||||
int ix;
|
||||
@@ -278,8 +271,6 @@ static float GetFrameLength(SpectSeq *spect, int frame)
|
||||
return (spect->frames[ix]->time - spect->frames[frame]->time) * 1000.0 + adjust;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
{
|
||||
short n, temp;
|
||||
@@ -360,7 +351,6 @@ int LoadSpectSeq(SpectSeq *spect, const char *filename)
|
||||
frame_width = (int)((FRAME_WIDTH*spect->max_x)/MAX_DISPLAY_FREQ);
|
||||
if (frame_width > FRAME_WIDTH) frame_width = FRAME_WIDTH;
|
||||
|
||||
|
||||
// start times from zero
|
||||
time_offset = spect->frames[0]->time;
|
||||
for (ix = 0; ix < spect->numframes; ix++)
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "translate.h"
|
||||
#include "voice.h"
|
||||
|
||||
|
||||
#ifdef INCLUDE_MBROLA
|
||||
|
||||
extern int Read4Bytes(FILE *f);
|
||||
@@ -69,11 +68,8 @@ PROCVI setNoError_MBR;
|
||||
PROCIV getFreq_MBR;
|
||||
PROCVF setVolumeRatio_MBR;
|
||||
|
||||
|
||||
|
||||
HINSTANCE hinstDllMBR = NULL;
|
||||
|
||||
|
||||
BOOL load_MBR()
|
||||
{
|
||||
if (hinstDllMBR != NULL)
|
||||
@@ -94,7 +90,6 @@ BOOL load_MBR()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void unload_MBR()
|
||||
{
|
||||
if (hinstDllMBR) {
|
||||
@@ -105,7 +100,6 @@ void unload_MBR()
|
||||
|
||||
#endif // windows
|
||||
|
||||
|
||||
static MBROLA_TAB *mbrola_tab = NULL;
|
||||
static int mbrola_control = 0;
|
||||
static int mbr_name_prefix = 0;
|
||||
@@ -190,7 +184,6 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
|
||||
static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev, PHONEME_TAB *ph_next, int *name2, int *split, int *control)
|
||||
{
|
||||
// Look up a phoneme in the mbrola phoneme name translation table
|
||||
@@ -267,7 +260,6 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev
|
||||
return mnem;
|
||||
}
|
||||
|
||||
|
||||
static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
{
|
||||
// final=1: only give the final pitch value.
|
||||
@@ -291,10 +283,8 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
output[0] = 0;
|
||||
pitch_env = envelope_data[env];
|
||||
|
||||
|
||||
SetPitch2(voice, pitch1, pitch2, &pitch_base, &pitch_range);
|
||||
|
||||
|
||||
env_split = (split * 128)/100;
|
||||
if (env_split < 0)
|
||||
env_split = 0-env_split;
|
||||
@@ -324,7 +314,6 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
p1 = ((pitch_env[0]*pitch_range)>>8) + pitch_base; // Hz << 12
|
||||
p_end = ((pitch_env[127]*pitch_range)>>8) + pitch_base;
|
||||
|
||||
|
||||
if (split >= 0) {
|
||||
sprintf(buf, " 0 %d", p1/4096);
|
||||
strcat(output, buf);
|
||||
@@ -364,7 +353,6 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbrola)
|
||||
{
|
||||
// Generate a mbrola pho file
|
||||
@@ -479,7 +467,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
}
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case phSTOP:
|
||||
released = 0;
|
||||
if (next->type == phVOWEL) released = 1;
|
||||
@@ -493,11 +480,9 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
len = (len * 1000)/samplerate; // convert to mS
|
||||
len += PauseLength(p->prepause, 1);
|
||||
break;
|
||||
|
||||
case phVSTOP:
|
||||
len = (80 * speed.wav_factor)/256;
|
||||
break;
|
||||
|
||||
case phFRICATIVE:
|
||||
len = 0;
|
||||
InterpretPhoneme(NULL, 0, p, &phdata, NULL);
|
||||
@@ -507,7 +492,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
|
||||
len = (len * 1000)/samplerate; // convert to mS
|
||||
break;
|
||||
|
||||
case phNASAL:
|
||||
if (next->type != phVOWEL) {
|
||||
memset(&fmtp, 0, sizeof(fmtp));
|
||||
@@ -520,7 +504,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
final_pitch = WritePitch(p->env, p->pitch1, p->pitch2, 0, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case phLIQUID:
|
||||
if (next->type == phPAUSE) {
|
||||
len += 50;
|
||||
@@ -572,7 +555,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
{
|
||||
FILE *f_mbrola = NULL;
|
||||
@@ -591,7 +573,6 @@ int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
return again;
|
||||
}
|
||||
|
||||
|
||||
int MbrolaFill(int length, int resume, int amplitude)
|
||||
{
|
||||
// Read audio data from Mbrola (length is in millisecs)
|
||||
@@ -628,7 +609,6 @@ int MbrolaFill(int length, int resume, int amplitude)
|
||||
return n_samples ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
void MbrolaReset(void)
|
||||
{
|
||||
// Reset the Mbrola engine and flush the pending audio
|
||||
@@ -659,5 +639,4 @@ void MbrolaReset(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif // INCLUDE_MBROLA
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "speak_lib.h"
|
||||
#include "speech.h"
|
||||
#include "phoneme.h"
|
||||
@@ -72,8 +71,6 @@ int vowel_transition1;
|
||||
|
||||
int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which);
|
||||
|
||||
|
||||
|
||||
static char *ReadPhFile(void *ptr, const char *fname, int *size)
|
||||
{
|
||||
FILE *f_in;
|
||||
@@ -108,7 +105,6 @@ static char *ReadPhFile(void *ptr, const char *fname, int *size)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
int LoadPhData(int *srate)
|
||||
{
|
||||
int ix;
|
||||
@@ -168,7 +164,6 @@ int LoadPhData(int *srate)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void FreePhData(void)
|
||||
{
|
||||
Free(phoneme_tab_data);
|
||||
@@ -181,7 +176,6 @@ void FreePhData(void)
|
||||
tunes = NULL;
|
||||
}
|
||||
|
||||
|
||||
int PhonemeCode(unsigned int mnem)
|
||||
{
|
||||
int ix;
|
||||
@@ -195,7 +189,6 @@ int PhonemeCode(unsigned int mnem)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int LookupPhonemeString(const char *string)
|
||||
{
|
||||
int ix;
|
||||
@@ -213,9 +206,6 @@ int LookupPhonemeString(const char *string)
|
||||
return PhonemeCode(mnem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, int *n_frames, PHONEME_LIST *plist)
|
||||
{
|
||||
int ix;
|
||||
@@ -235,7 +225,6 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params,
|
||||
seqk = (SPECT_SEQK *)seq;
|
||||
nf = seq->n_frames;
|
||||
|
||||
|
||||
if (nf >= N_SEQ_FRAMES)
|
||||
nf = N_SEQ_FRAMES - 1;
|
||||
|
||||
@@ -342,8 +331,6 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params,
|
||||
return frames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned char *GetEnvelope(int index)
|
||||
{
|
||||
if (index == 0) {
|
||||
@@ -353,7 +340,6 @@ unsigned char *GetEnvelope(int index)
|
||||
return (unsigned char *)&phondata_ptr[index];
|
||||
}
|
||||
|
||||
|
||||
static void SetUpPhonemeTable(int number, int recursing)
|
||||
{
|
||||
int ix;
|
||||
@@ -382,7 +368,6 @@ static void SetUpPhonemeTable(int number, int recursing)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectPhonemeTable(int number)
|
||||
{
|
||||
n_phoneme_tab = 0;
|
||||
@@ -391,7 +376,6 @@ void SelectPhonemeTable(int number)
|
||||
current_phoneme_table = number;
|
||||
}
|
||||
|
||||
|
||||
int LookupPhonemeTable(const char *name)
|
||||
{
|
||||
int ix;
|
||||
@@ -408,7 +392,6 @@ int LookupPhonemeTable(const char *name)
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
int SelectPhonemeTableName(const char *name)
|
||||
{
|
||||
// Look up a phoneme set by name, and select it if it exists
|
||||
@@ -422,9 +405,6 @@ int SelectPhonemeTableName(const char *name)
|
||||
return ix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LoadConfig(void)
|
||||
{
|
||||
// Load configuration file, if one exists
|
||||
@@ -473,18 +453,13 @@ void LoadConfig(void)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PHONEME_DATA this_ph_data;
|
||||
|
||||
|
||||
static void InvalidInstn(PHONEME_TAB *ph, int instn)
|
||||
{
|
||||
fprintf(stderr, "Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(ph->mnemonic));
|
||||
}
|
||||
|
||||
|
||||
static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition, int control)
|
||||
{
|
||||
// condition:
|
||||
@@ -533,7 +508,6 @@ static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition,
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int CountVowelPosition(PHONEME_LIST *plist)
|
||||
{
|
||||
int count = 0;
|
||||
@@ -548,7 +522,6 @@ static int CountVowelPosition(PHONEME_LIST *plist)
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, USHORT *p_prog, WORD_PH_DATA *worddata)
|
||||
{
|
||||
int which;
|
||||
@@ -599,7 +572,6 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
switch (which)
|
||||
{
|
||||
case 0: // prevPh
|
||||
@@ -607,20 +579,16 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
plist--;
|
||||
check_endtype = 1;
|
||||
break;
|
||||
|
||||
case 1: // thisPh
|
||||
break;
|
||||
|
||||
case 2: // nextPh
|
||||
case 4: // nextPhW
|
||||
plist++;
|
||||
break;
|
||||
|
||||
case 3: // next2Ph
|
||||
case 6: // next2PhW
|
||||
plist += 2;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// nextVowel, not word boundary
|
||||
for (which = 1;; which++) {
|
||||
@@ -632,14 +600,12 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // prevVowel in this word
|
||||
if ((worddata == NULL) || (worddata->prev_vowel.ph == NULL))
|
||||
return false; // no previous vowel
|
||||
plist = &(worddata->prev_vowel);
|
||||
check_endtype = 1;
|
||||
break;
|
||||
|
||||
case 9: // next3PhW
|
||||
for (ix = 1; ix <= 3; ix++) {
|
||||
if (plist[ix].sourceix)
|
||||
@@ -647,7 +613,6 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
}
|
||||
plist = &plist[3];
|
||||
break;
|
||||
|
||||
case 10: // prev2PhW
|
||||
if ((plist[0].sourceix) || (plist[-1].sourceix))
|
||||
return false;
|
||||
@@ -688,17 +653,14 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
// phoneme type, vowel, nasal, fricative, etc
|
||||
return ph->type == data;
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
// place of articulation
|
||||
return ((ph->phflags >> 16) & 0xf) == data;
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
// is a bit set in phoneme flags
|
||||
return (ph->phflags & (1 << data)) != 0;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
switch (data)
|
||||
{
|
||||
@@ -708,20 +670,15 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
case 3:
|
||||
case 4:
|
||||
return StressCondition(tr, plist, data, 0);
|
||||
|
||||
case 5: // isBreak, Either pause phoneme, or (stop/vstop/vfric not followed by vowel or (liquid in same word))
|
||||
return (ph->type == phPAUSE) || (plist_this->synthflags & SFLAG_NEXT_PAUSE);
|
||||
|
||||
case 6: // isWordStart
|
||||
return plist->sourceix != 0;
|
||||
|
||||
case 7: // notWordStart
|
||||
return plist->sourceix == 0;
|
||||
|
||||
case 8: // isWordEnd
|
||||
return plist[1].sourceix || (plist[1].ph->type == phPAUSE);
|
||||
break;
|
||||
|
||||
case 9: // isAfterStress
|
||||
if (plist->sourceix != 0)
|
||||
return false;
|
||||
@@ -732,10 +689,8 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
|
||||
} while (plist->sourceix == 0);
|
||||
break;
|
||||
|
||||
case 10: // isNotVowel
|
||||
return ph->type != phVOWEL;
|
||||
|
||||
case 11: // isFinalVowel
|
||||
for (;;) {
|
||||
plist++;
|
||||
@@ -746,16 +701,12 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: // isVoiced
|
||||
return (ph->type == phVOWEL) || (ph->type == phLIQUID) || (ph->phflags & phVOICED);
|
||||
|
||||
case 13: // isFirstVowel
|
||||
return CountVowelPosition(plist) == 1;
|
||||
|
||||
case 14: // isSecondVowel
|
||||
return CountVowelPosition(plist) == 2;
|
||||
|
||||
case 15: // isSeqFlag1
|
||||
// is this preceded by a sequence if 1 or more vowels which have 'flag1' ? (lang=hi)
|
||||
if (plist->sourceix != 0)
|
||||
@@ -774,7 +725,6 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
break;
|
||||
}
|
||||
return count > 0;
|
||||
|
||||
case 0x10: // isTranslationGiven
|
||||
return (plist->synthflags & SFLAG_DICTIONARY) != 0;
|
||||
}
|
||||
@@ -797,7 +747,6 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void SwitchOnVowelType(PHONEME_LIST *plist, PHONEME_DATA *phdata, USHORT **p_prog, int instn_type)
|
||||
{
|
||||
USHORT *prog;
|
||||
@@ -821,7 +770,6 @@ static void SwitchOnVowelType(PHONEME_LIST *plist, PHONEME_DATA *phdata, USHORT
|
||||
*p_prog += 12;
|
||||
}
|
||||
|
||||
|
||||
int NumInstnWords(USHORT *prog)
|
||||
{
|
||||
int instn;
|
||||
@@ -844,20 +792,17 @@ int NumInstnWords(USHORT *prog)
|
||||
return n+1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
case 6:
|
||||
type2 = (instn & 0xf00) >> 9;
|
||||
if ((type2 == 5) || (type2 == 6))
|
||||
return 12; // switch on vowel type
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
// a condition, check for a 2-word instruction
|
||||
if (((n = instn & 0x0f00) == 0x600) || (n == 0x0d00))
|
||||
return 2;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
// instn_type 11 to 15, 2 words
|
||||
instn2 = prog[2];
|
||||
@@ -871,8 +816,6 @@ int NumInstnWords(USHORT *prog)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_DATA *phdata, WORD_PH_DATA *worddata)
|
||||
{
|
||||
// control:
|
||||
@@ -963,7 +906,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
} else
|
||||
InvalidInstn(ph, instn);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (tr == NULL)
|
||||
break; // ignore if in synthesis stage
|
||||
@@ -976,7 +918,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
// conditions
|
||||
@@ -1011,7 +952,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
}
|
||||
prog--;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// JUMP
|
||||
switch (instn2 >> 1)
|
||||
@@ -1033,7 +973,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
data = ((instn & 0xf) << 16) + prog[1];
|
||||
prog++;
|
||||
@@ -1046,19 +985,16 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
prog = &phoneme_index[data] - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// pitch envelope
|
||||
phdata->pitch_env = data;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// amplitude envelope
|
||||
phdata->amp_env = data;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: // Vowelin, Vowelout
|
||||
if (instn2 == 1)
|
||||
ix = 0;
|
||||
@@ -1069,7 +1005,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
phdata->vowel_transition[ix+1] = (prog[2] << 16) + prog[3];
|
||||
prog += 3;
|
||||
break;
|
||||
|
||||
case 11: // FMT
|
||||
case 12: // WAV
|
||||
case 13: // VowelStart
|
||||
@@ -1099,7 +1034,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
InvalidInstn(ph, instn);
|
||||
break;
|
||||
@@ -1128,7 +1062,6 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InterpretPhoneme2(int phcode, PHONEME_DATA *phdata)
|
||||
{
|
||||
// Examine the program of a single isolated phoneme
|
||||
|
||||
@@ -36,11 +36,9 @@
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
extern FILE *f_log;
|
||||
static void SmoothSpect(void);
|
||||
|
||||
|
||||
// list of phonemes in a clause
|
||||
int n_phoneme_list = 0;
|
||||
PHONEME_LIST phoneme_list[N_PHONEME_LIST+1];
|
||||
@@ -73,12 +71,9 @@ SOUND_ICON soundicon_tab[N_SOUNDICON_TAB];
|
||||
|
||||
#define VOWEL_FRONT_LENGTH 50
|
||||
|
||||
|
||||
|
||||
// a dummy phoneme_list entry which looks like a pause
|
||||
static PHONEME_LIST next_pause;
|
||||
|
||||
|
||||
const char *WordToString(unsigned int word)
|
||||
{
|
||||
// Convert a phoneme mnemonic word into a string
|
||||
@@ -91,8 +86,6 @@ const char *WordToString(unsigned int word)
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SynthesizeInit()
|
||||
{
|
||||
last_pitch_cmd = 0;
|
||||
@@ -105,8 +98,6 @@ void SynthesizeInit()
|
||||
next_pause.newword = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void EndAmplitude(void)
|
||||
{
|
||||
if (amp_length > 0) {
|
||||
@@ -116,8 +107,6 @@ static void EndAmplitude(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void EndPitch(int voice_break)
|
||||
{
|
||||
// posssible end of pitch envelope, fill in the length
|
||||
@@ -137,8 +126,6 @@ static void EndPitch(int voice_break)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void DoAmplitude(int amp, unsigned char *amp_env)
|
||||
{
|
||||
intptr_t *q;
|
||||
@@ -154,8 +141,6 @@ static void DoAmplitude(int amp, unsigned char *amp_env)
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void DoPitch(unsigned char *env, int pitch1, int pitch2)
|
||||
{
|
||||
intptr_t *q;
|
||||
@@ -182,8 +167,6 @@ static void DoPitch(unsigned char *env, int pitch1, int pitch2)
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int PauseLength(int pause, int control)
|
||||
{
|
||||
unsigned int len;
|
||||
@@ -202,7 +185,6 @@ int PauseLength(int pause, int control)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
static void DoPause(int length, int control)
|
||||
{
|
||||
// length in nominal mS
|
||||
@@ -236,10 +218,8 @@ static void DoPause(int length, int control)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int seq_len_adjust; // temporary fix to advance the start point for playing the wav sample
|
||||
|
||||
|
||||
static int DoSample2(int index, int which, int std_length, int control, int length_mod, int amp)
|
||||
{
|
||||
int length;
|
||||
@@ -337,7 +317,6 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
|
||||
|
||||
while (length > len4*3) {
|
||||
x = len4;
|
||||
if (wav_scale == 0)
|
||||
@@ -370,8 +349,6 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp)
|
||||
{
|
||||
int amp2;
|
||||
@@ -398,9 +375,6 @@ int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static frame_t *AllocFrame()
|
||||
{
|
||||
// Allocate a temporary spectrum frame for the wavegen queue. Use a pool which is big
|
||||
@@ -417,7 +391,6 @@ static frame_t *AllocFrame()
|
||||
return &frame_pool[ix];
|
||||
}
|
||||
|
||||
|
||||
static void set_frame_rms(frame_t *fr, int new_rms)
|
||||
{
|
||||
// Each frame includes its RMS amplitude value, so to set a new
|
||||
@@ -461,8 +434,6 @@ static void set_frame_rms(frame_t *fr, int new_rms)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void formants_reduce_hf(frame_t *fr, int level)
|
||||
{
|
||||
// change height of peaks 2 to 8, percentage
|
||||
@@ -478,7 +449,6 @@ static void formants_reduce_hf(frame_t *fr, int level)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static frame_t *CopyFrame(frame_t *frame1, int copy)
|
||||
{
|
||||
// create a copy of the specified frame in temporary buffer
|
||||
@@ -498,7 +468,6 @@ static frame_t *CopyFrame(frame_t *frame1, int copy)
|
||||
return frame2;
|
||||
}
|
||||
|
||||
|
||||
static frame_t *DuplicateLastFrame(frameref_t *seq, int n_frames, int length)
|
||||
{
|
||||
frame_t *fr;
|
||||
@@ -510,7 +479,6 @@ static frame_t *DuplicateLastFrame(frameref_t *seq, int n_frames, int length)
|
||||
return fr;
|
||||
}
|
||||
|
||||
|
||||
static void AdjustFormants(frame_t *fr, int target, int min, int max, int f1_adj, int f3_adj, int hf_reduce, int flags)
|
||||
{
|
||||
int x;
|
||||
@@ -551,7 +519,6 @@ static void AdjustFormants(frame_t *fr, int target, int min, int max, int f1_adj
|
||||
formants_reduce_hf(fr, hf_reduce);
|
||||
}
|
||||
|
||||
|
||||
static int VowelCloseness(frame_t *fr)
|
||||
{
|
||||
// return a value 0-3 depending on the vowel's f1
|
||||
@@ -566,7 +533,6 @@ static int VowelCloseness(frame_t *fr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which)
|
||||
{
|
||||
int ix;
|
||||
@@ -694,8 +660,6 @@ int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsig
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SmoothSpect(void)
|
||||
{
|
||||
// Limit the rate of frequence change of formants, to reduce chirping
|
||||
@@ -806,7 +770,6 @@ static void SmoothSpect(void)
|
||||
break;
|
||||
|
||||
if (q[0] <= WCMD_SPECT2) {
|
||||
|
||||
len = q[1] & 0xffff;
|
||||
|
||||
frame1 = (frame_t *)q[2];
|
||||
@@ -867,7 +830,6 @@ static void SmoothSpect(void)
|
||||
syllable_start = syllable_end;
|
||||
}
|
||||
|
||||
|
||||
static void StartSyllable(void)
|
||||
{
|
||||
// start of syllable, if not already started
|
||||
@@ -875,8 +837,6 @@ static void StartSyllable(void)
|
||||
syllable_end = wcmdq_tail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation)
|
||||
{
|
||||
// which: 0 not a vowel, 1 start of vowel, 2 body and end of vowel
|
||||
@@ -1058,13 +1018,9 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
|
||||
return total_len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DoMarker(int type, int char_posn, int length, int value)
|
||||
{
|
||||
// This could be used to return an index to the word currently being spoken
|
||||
@@ -1077,7 +1033,6 @@ void DoMarker(int type, int char_posn, int length, int value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DoPhonemeMarker(int type, int char_posn, int length, char *name)
|
||||
{
|
||||
// This could be used to return an index to the word currently being spoken
|
||||
@@ -1094,7 +1049,6 @@ void DoPhonemeMarker(int type, int char_posn, int length, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_SONIC_H
|
||||
void DoSonicSpeed(int value)
|
||||
{
|
||||
@@ -1105,7 +1059,6 @@ void DoSonicSpeed(int value)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void DoVoiceChange(voice_t *v)
|
||||
{
|
||||
// allocate memory for a copy of the voice data, and free it in wavegenfill()
|
||||
@@ -1118,7 +1071,6 @@ void DoVoiceChange(voice_t *v)
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
|
||||
void DoEmbedded(int *embix, int sourceix)
|
||||
{
|
||||
// There were embedded commands in the text at this point
|
||||
@@ -1142,7 +1094,6 @@ void DoEmbedded(int *embix, int sourceix)
|
||||
SetEmbedded((command & 0x60) + EMBED_S2, value); // adjusts embedded_value[EMBED_S2]
|
||||
SetSpeed(2);
|
||||
break;
|
||||
|
||||
case EMBED_I: // play dynamically loaded wav data (sound icon)
|
||||
if ((int)value < n_soundicon_tab) {
|
||||
if (soundicon_tab[value].length != 0) {
|
||||
@@ -1155,15 +1106,12 @@ void DoEmbedded(int *embix, int sourceix)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EMBED_M: // named marker
|
||||
DoMarker(espeakEVENT_MARK, (sourceix & 0x7ff) + clause_start_char, 0, value);
|
||||
break;
|
||||
|
||||
case EMBED_U: // play sound
|
||||
DoMarker(espeakEVENT_PLAY, count_characters+1, 0, value); // always occurs at end of clause
|
||||
break;
|
||||
|
||||
default:
|
||||
DoPause(10, 0); // ensure a break in the speech
|
||||
wcmdq[wcmdq_tail][0] = WCMD_EMBEDDED;
|
||||
@@ -1175,8 +1123,6 @@ void DoEmbedded(int *embix, int sourceix)
|
||||
} while ((word & 0x80) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
{
|
||||
static int ix;
|
||||
@@ -1291,7 +1237,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoPause(p->length, 0);
|
||||
p->std_length = p->ph->std_length;
|
||||
break;
|
||||
|
||||
case phSTOP:
|
||||
released = 0;
|
||||
ph = p->ph;
|
||||
@@ -1322,7 +1267,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
phdata.pd_control |= pd_DONTLENGTHEN;
|
||||
DoSample3(&phdata, 0, 0);
|
||||
break;
|
||||
|
||||
case phFRICATIVE:
|
||||
InterpretPhoneme(NULL, 0, p, &phdata, &worddata);
|
||||
|
||||
@@ -1330,7 +1274,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoSample3(&phdata, p->length, 0); // play it twice for [s:] etc.
|
||||
DoSample3(&phdata, p->length, 0);
|
||||
break;
|
||||
|
||||
case phVSTOP:
|
||||
ph = p->ph;
|
||||
memset(&fmtp, 0, sizeof(fmtp));
|
||||
@@ -1387,7 +1330,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoPause(12, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case phVFRICATIVE:
|
||||
if (next->type == phVOWEL) {
|
||||
DoAmplitude(p->amp, NULL);
|
||||
@@ -1418,7 +1360,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoSpect2(p->ph, 0, &fmtp, p, 0);
|
||||
DoSpect2(p->ph, 0, &fmtp, p, 0);
|
||||
break;
|
||||
|
||||
case phNASAL:
|
||||
memset(&fmtp, 0, sizeof(fmtp));
|
||||
if (!(p->synthflags & SFLAG_SEQCONTINUE)) {
|
||||
@@ -1446,7 +1387,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case phLIQUID:
|
||||
memset(&fmtp, 0, sizeof(fmtp));
|
||||
modulation = 0;
|
||||
@@ -1473,9 +1413,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
fmtp.wav_addr = phdata.sound_addr[pd_ADDWAV];
|
||||
fmtp.wav_amp = phdata.sound_param[pd_ADDWAV];
|
||||
DoSpect2(p->ph, 0, &fmtp, p, modulation);
|
||||
|
||||
break;
|
||||
|
||||
case phVOWEL:
|
||||
ph = p->ph;
|
||||
stress = p->stresslevel & 0xf;
|
||||
@@ -1576,7 +1514,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
}
|
||||
|
||||
DoSpect2(ph, 2, &fmtp, p, modulation);
|
||||
|
||||
break;
|
||||
}
|
||||
ix++;
|
||||
@@ -1590,9 +1527,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
return 0; // finished the phoneme list
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int timer_on = 0;
|
||||
static int paused = 0;
|
||||
|
||||
@@ -1612,14 +1546,11 @@ int SynthOnTimer()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SynthStatus()
|
||||
{
|
||||
return timer_on | paused;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
{
|
||||
// Speak text from file (f_in) or memory (text_in)
|
||||
|
||||
+56
-146
@@ -37,8 +37,6 @@
|
||||
#include "synthesize.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
|
||||
#define L_qa 0x716100
|
||||
#define L_grc 0x677263 // grc Ancient Greek
|
||||
#define L_jbo 0x6a626f // jbo Lojban
|
||||
@@ -74,7 +72,6 @@
|
||||
#define OFFSET_KOREAN 0x1100
|
||||
#define OFFSET_ETHIOPIC 0x1200
|
||||
|
||||
|
||||
// character ranges must be listed in ascending unicode order
|
||||
ALPHABET alphabets[] = {
|
||||
{ "_el", OFFSET_GREEK, 0x380, 0x3ff, L('e', 'l'), AL_DONT_NAME | AL_NOT_LETTERS | AL_WORDS },
|
||||
@@ -108,7 +105,6 @@ ALPHABET alphabets[] = {
|
||||
{ NULL, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
ALPHABET *AlphabetFromName(const char *name)
|
||||
{
|
||||
ALPHABET *alphabet;
|
||||
@@ -120,7 +116,6 @@ ALPHABET *AlphabetFromName(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ALPHABET *AlphabetFromChar(int c)
|
||||
{
|
||||
// Find the alphabet from a character.
|
||||
@@ -138,12 +133,8 @@ ALPHABET *AlphabetFromChar(int c)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Translator_Russian(Translator *tr);
|
||||
|
||||
|
||||
|
||||
static void SetLetterVowel(Translator *tr, int c)
|
||||
{
|
||||
tr->letter_bits[c] = (tr->letter_bits[c] & 0x40) | 0x81; // keep value for group 6 (front vowels e,i,y)
|
||||
@@ -200,7 +191,6 @@ static const unsigned short chars_ignore_zwnj_hyphen[] = {
|
||||
|
||||
const char string_ordinal[] = { 0xc2, 0xba, 0 }; // masculine ordinal character, UTF-8
|
||||
|
||||
|
||||
static Translator *NewTranslator(void)
|
||||
{
|
||||
Translator *tr;
|
||||
@@ -268,7 +258,6 @@ static Translator *NewTranslator(void)
|
||||
SetLetterBits(tr, 6, "eiy"); // Letter group Y, front vowels
|
||||
SetLetterBits(tr, 7, "aeiouy"); // vowels, including y
|
||||
|
||||
|
||||
tr->char_plus_apostrophe = empty_wstring;
|
||||
tr->punct_within_word = punct_in_word;
|
||||
tr->chars_ignore = chars_ignore_default;
|
||||
@@ -350,8 +339,6 @@ static const short pairs_ru[] = {
|
||||
0x7fff
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const unsigned int replace_cyrillic_latin[] =
|
||||
{ 0x430, 'a',
|
||||
0x431, 'b',
|
||||
@@ -388,7 +375,6 @@ static const unsigned int replace_cyrillic_latin[] =
|
||||
0x45c, 0x107,
|
||||
0 }; // ѓ ѕ ќ
|
||||
|
||||
|
||||
static const unsigned char ru_vowels[] = { 0x10, 0x15, 0x31, 0x18, 0x1e, 0x23, 0x2b, 0x2d, 0x2e, 0x2f, 0xb9, 0xc9, 0x91, 0x8f, 0x36, 0 }; // also kazakh
|
||||
static const unsigned char ru_consonants[] = { 0x11, 0x12, 0x13, 0x14, 0x16, 0x17, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1f, 0x20, 0x21, 0x22, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2c, 0x73, 0x7b, 0x83, 0x9b, 0 };
|
||||
|
||||
@@ -418,7 +404,6 @@ static void SetCyrillicLetters(Translator *tr)
|
||||
SetLetterBits(tr, LETTERGP_VOWEL2, (char *)ru_vowels);
|
||||
}
|
||||
|
||||
|
||||
void SetIndicLetters(Translator *tr)
|
||||
{
|
||||
// Set letter types for Indic scripts, Devanagari, Tamill, etc
|
||||
@@ -444,7 +429,6 @@ void SetIndicLetters(Translator *tr)
|
||||
tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4d; // virama
|
||||
}
|
||||
|
||||
|
||||
void SetupTranslator(Translator *tr, const short *lengths, const unsigned char *amps)
|
||||
{
|
||||
if (lengths != NULL)
|
||||
@@ -453,7 +437,6 @@ void SetupTranslator(Translator *tr, const short *lengths, const unsigned char *
|
||||
memcpy(tr->stress_amps, amps, sizeof(tr->stress_amps));
|
||||
}
|
||||
|
||||
|
||||
Translator *SelectTranslator(const char *name)
|
||||
{
|
||||
int name2 = 0;
|
||||
@@ -495,8 +478,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_ROMAN | NUM_1900;
|
||||
tr->langopts.accents = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('a', 'm'): // Amharic, Ethiopia
|
||||
{
|
||||
SetupTranslator(tr, stress_lengths_fr, stress_amps_fr);
|
||||
@@ -507,11 +489,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
tr->langopts.numbers = NUM_OMIT_1_HUNDRED;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case L('a', 'r'): // Arabic
|
||||
tr->transpose_min = 0x620; // for ar_list, use 6-bit character codes
|
||||
tr->transpose_max = 0x65f;
|
||||
@@ -520,7 +498,6 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SWAP_TENS | NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_AND_HUNDRED | NUM_THOUSAND_AND | NUM_OMIT_1_THOUSAND;
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
break;
|
||||
|
||||
case L('b', 'g'): // Bulgarian
|
||||
{
|
||||
SetCyrillicLetters(tr);
|
||||
@@ -533,8 +510,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_SINGLE_AND | NUM_ROMAN | NUM_ROMAN_ORDINAL | NUM_ROMAN_CAPITALS;
|
||||
tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('b', 'n'): // Bengali
|
||||
case L('a', 's'): // Assamese
|
||||
case L_mni: // Manipuri (temporary placement - it's not indo-european)
|
||||
@@ -563,8 +539,7 @@ Translator *SelectTranslator(const char *name)
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('b', 'o'): // Tibet
|
||||
{
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
@@ -576,8 +551,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
tr->langopts.numbers = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('c', 'y'): // Welsh
|
||||
{
|
||||
static const short stress_lengths_cy[8] = { 170, 220, 180, 180, 0, 0, 250, 270 };
|
||||
@@ -599,8 +573,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'w'); // add letter to vowels and remove from consonants
|
||||
SetLetterVowel(tr, 'y');
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('d', 'a'): // Danish
|
||||
{
|
||||
static const short stress_lengths_da[8] = { 160, 140, 200, 200, 0, 0, 220, 230 };
|
||||
@@ -611,9 +584,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'y');
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('d', 'e'):
|
||||
{
|
||||
static const short stress_lengths_de[8] = { 150, 130, 200, 200, 0, 0, 270, 270 };
|
||||
@@ -630,8 +601,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'y');
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use de_rules for unpronouncable rules
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('d', 'v'): // Divehi (Maldives)
|
||||
{
|
||||
SetupTranslator(tr, stress_lengths_ta, stress_amps_ta);
|
||||
@@ -644,8 +614,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.break_numbers = 0x14a8; // 1000, 100,000 10,000,000
|
||||
tr->langopts.numbers = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('e', 'n'):
|
||||
{
|
||||
static const short stress_lengths_en[8] = { 182, 140, 220, 220, 0, 0, 248, 275 };
|
||||
@@ -659,8 +628,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use en_rules for unpronouncable rules
|
||||
SetLetterBits(tr, 6, "aeiouy"); // Group Y: vowels, including y
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('e', 'l'): // Greek
|
||||
case L_grc: // Ancient Greek
|
||||
{
|
||||
@@ -702,8 +670,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('e', 'o'):
|
||||
{
|
||||
static const short stress_lengths_eo[8] = { 150, 140, 180, 180, 0, 0, 200, 200 };
|
||||
@@ -722,8 +689,7 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_ALLOW_SPACE | NUM_ROMAN;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('e', 's'): // Spanish
|
||||
case L('a', 'n'): // Aragonese
|
||||
case L('c', 'a'): // Catalan
|
||||
@@ -768,8 +734,7 @@ Translator *SelectTranslator(const char *name)
|
||||
} else
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use es_rules for unpronouncable rules
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('e', 'u'): // basque
|
||||
{
|
||||
static const short stress_lengths_eu[8] = { 200, 200, 200, 200, 0, 0, 210, 230 }; // very weak stress
|
||||
@@ -780,9 +745,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_SUFFIX] = 1;
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_VIGESIMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('f', 'a'): // Farsi
|
||||
{
|
||||
// Convert characters in the range 0x620 to 0x6cc to the range 1 to 63.
|
||||
@@ -810,12 +773,10 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
tr->chars_ignore = chars_ignore_zwnj_hyphen; // replace ZWNJ by hyphen
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('e', 't'): // Estonian
|
||||
tr->charset_a0 = charsets[4]; // ISO-8859-4
|
||||
// drop through to Finnish
|
||||
// drop through to Finnish
|
||||
case L('f', 'i'): // Finnish
|
||||
{
|
||||
static const unsigned char stress_amps_fi[8] = { 18, 16, 22, 22, 20, 22, 22, 22 };
|
||||
@@ -833,8 +794,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.spelling_stress = 1;
|
||||
tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('f', 'r'): // french
|
||||
{
|
||||
SetupTranslator(tr, stress_lengths_fr, stress_amps_fr);
|
||||
@@ -847,8 +807,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_AFTER | NUM_VIGESIMAL | NUM_DFRACTION_4;
|
||||
SetLetterVowel(tr, 'y');
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('g', 'a'): // irish
|
||||
case L('g', 'd'): // scots gaelic
|
||||
{
|
||||
@@ -859,8 +818,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 3; // don't count apostrophe
|
||||
tr->langopts.param[LOPT_IT_LENGTHEN] = 1; // remove [:] phoneme from non-stressed syllables (Lang=gd)
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('h', 'i'): // Hindi
|
||||
case L('n', 'e'): // Nepali
|
||||
case L('o', 'r'): // Oriya
|
||||
@@ -896,9 +854,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->letter_bits_offset = OFFSET_ORIYA;
|
||||
SetIndicLetters(tr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('h', 'r'): // Croatian
|
||||
case L('b', 's'): // Bosnian
|
||||
case L('s', 'r'): // Serbian
|
||||
@@ -930,16 +886,12 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'y');
|
||||
SetLetterVowel(tr, 'r');
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('h', 't'): // Haitian Creole
|
||||
tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable
|
||||
tr->langopts.stress_flags = S_NO_AUTO_2 | S_FINAL_DIM; // don't use secondary stress
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_VIGESIMAL | NUM_DFRACTION_4;
|
||||
break;
|
||||
|
||||
|
||||
case L('h', 'u'): // Hungarian
|
||||
{
|
||||
static const unsigned char stress_amps_hu[8] = { 17, 17, 19, 19, 20, 22, 22, 21 };
|
||||
@@ -964,8 +916,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.spelling_stress = 1;
|
||||
SetLengthMods(tr, 3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('h', 'y'): // Armenian
|
||||
{
|
||||
static const short stress_lengths_hy[8] = { 250, 200, 250, 250, 0, 0, 250, 250 };
|
||||
@@ -987,8 +938,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.max_initial_consonants = 6;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('i', 'd'): // Indonesian
|
||||
case L('m', 's'): // Malay
|
||||
{
|
||||
@@ -1001,8 +951,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2;
|
||||
tr->langopts.accents = 2; // "capital" after letter name
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('i', 's'): // Icelandic
|
||||
{
|
||||
static const short stress_lengths_is[8] = { 180, 160, 200, 200, 0, 0, 240, 250 };
|
||||
@@ -1022,8 +971,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SINGLE_AND | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_1900;
|
||||
tr->langopts.numbers2 = 0x2;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('i', 't'): // Italian
|
||||
{
|
||||
static const short stress_lengths_it[8] =
|
||||
@@ -1049,8 +997,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.accents = 2; // Say "Capital" after the letter.
|
||||
SetLetterVowel(tr, 'y');
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L_jbo: // Lojban
|
||||
{
|
||||
static const short stress_lengths_jbo[8] = { 145, 145, 170, 160, 0, 0, 330, 350 };
|
||||
@@ -1064,8 +1011,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'y');
|
||||
tr->langopts.max_lengthmod = 368;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('k', 'a'): // Georgian
|
||||
{
|
||||
// character codes offset by 0x1080
|
||||
@@ -1088,8 +1034,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.alt_alphabet = OFFSET_CYRILLIC;
|
||||
tr->langopts.alt_alphabet_lang = L('r', 'u');
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('k', 'k'): // Kazakh
|
||||
{
|
||||
static const unsigned char stress_amps_tr[8] = { 18, 16, 20, 21, 20, 21, 21, 20 };
|
||||
@@ -1112,8 +1057,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
SetLengthMods(tr, 3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('k', 'l'): // Greenlandic
|
||||
{
|
||||
SetupTranslator(tr, stress_lengths_equal, stress_amps_equal);
|
||||
@@ -1121,8 +1065,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_flags = S_NO_AUTO_2;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('k', 'o'): // Korean, TEST
|
||||
{
|
||||
static const char ko_ivowels[] = { 0x63, 0x64, 0x67, 0x68, 0x6d, 0x72, 0x74, 0x75, 0 }; // y and i vowels
|
||||
@@ -1142,8 +1085,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.break_numbers = 0x1111110;
|
||||
tr->langopts.max_digits = 20;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('k', 'u'): // Kurdish
|
||||
{
|
||||
static const unsigned char stress_amps_ku[8] = { 18, 18, 20, 20, 20, 22, 22, 21 };
|
||||
@@ -1157,8 +1099,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_AND_HUNDRED;
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('l', 'a'): // Latin
|
||||
{
|
||||
tr->charset_a0 = charsets[4]; // ISO-8859-4, includes a,e,i,o,u-macron
|
||||
@@ -1170,8 +1111,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_ROMAN;
|
||||
tr->langopts.max_roman = 5000;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('l', 't'): // Lithuanian
|
||||
{
|
||||
tr->charset_a0 = charsets[4]; // ISO-8859-4
|
||||
@@ -1184,8 +1124,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR4;
|
||||
tr->langopts.max_roman = 5000;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('l', 'v'): // latvian
|
||||
{
|
||||
static const unsigned char stress_amps_lv[8] = { 17, 13, 20, 20, 20, 22, 22, 21 };
|
||||
@@ -1199,8 +1138,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
|
||||
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2 | S_EO_CLAUSE1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('m', 'k'): // Macedonian
|
||||
{
|
||||
static wchar_t vowels_cyrillic[] = { 0x440, // also include 'р' [R]
|
||||
@@ -1217,8 +1155,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
tr->langopts.numbers2 = 0x8a; // variant numbers before thousands,milliards
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('m', 't'): // Maltese
|
||||
{
|
||||
tr->charset_a0 = charsets[3]; // ISO-8859-3
|
||||
@@ -1226,8 +1163,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R; // penultimate
|
||||
tr->langopts.numbers = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('n', 'l'): // Dutch
|
||||
{
|
||||
static const short stress_lengths_nl[8] = { 160, 135, 210, 210, 0, 0, 260, 280 };
|
||||
@@ -1244,8 +1180,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_flags = S_FIRST_PRIMARY;
|
||||
memcpy(tr->stress_lengths, stress_lengths_nl, sizeof(tr->stress_lengths));
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('n', 'o'): // Norwegian
|
||||
{
|
||||
static const short stress_lengths_no[8] = { 160, 140, 200, 200, 0, 0, 220, 230 };
|
||||
@@ -1255,8 +1190,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterVowel(tr, 'y');
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('o', 'm'): // Oromo
|
||||
{
|
||||
static const unsigned char stress_amps_om[] = { 18, 15, 20, 20, 20, 22, 22, 22 };
|
||||
@@ -1268,8 +1202,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_HUNDRED_AND;
|
||||
tr->langopts.numbers2 = 0x200; // say "thousands" before its number
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('p', 'l'): // Polish
|
||||
{
|
||||
static const short stress_lengths_pl[8] = { 160, 190, 175, 175, 0, 0, 200, 210 };
|
||||
@@ -1287,8 +1220,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt)
|
||||
SetLetterVowel(tr, 'y');
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('p', 't'): // Portuguese
|
||||
{
|
||||
static const short stress_lengths_pt[8] = { 170, 115, 210, 240, 0, 0, 260, 280 };
|
||||
@@ -1308,8 +1240,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
|
||||
tr->langopts.accents = 2; // 'capital' after letter name
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('r', 'o'): // Romanian
|
||||
{
|
||||
static const short stress_lengths_ro[8] = { 170, 170, 180, 180, 0, 0, 240, 260 };
|
||||
@@ -1324,12 +1255,10 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_3 | NUM_AND_UNITS | NUM_ROMAN;
|
||||
tr->langopts.numbers2 = 0x1e; // variant numbers before all thousandplex
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('r', 'u'): // Russian
|
||||
Translator_Russian(tr);
|
||||
break;
|
||||
|
||||
case L('r', 'w'): // Kiryarwanda
|
||||
{
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
@@ -1339,8 +1268,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_2 | NUM_AND_HUNDRED;
|
||||
tr->langopts.numbers2 = 0x200; // say "thousands" before its number
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('s', 'k'): // Slovak
|
||||
case L('c', 's'): // Czech
|
||||
{
|
||||
@@ -1370,8 +1298,7 @@ Translator *SelectTranslator(const char *name)
|
||||
ResetLetterBits(tr, 0x20);
|
||||
SetLetterBits(tr, 5, sk_voiced);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('s', 'i'): // Sinhala
|
||||
{
|
||||
SetupTranslator(tr, stress_lengths_ta, stress_amps_ta);
|
||||
@@ -1396,8 +1323,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers2 = NUM2_PERCENT_BEFORE;
|
||||
tr->langopts.break_numbers = 0x14aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('s', 'l'): // Slovenian
|
||||
tr->charset_a0 = charsets[2]; // ISO-8859-2
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R; // Temporary
|
||||
@@ -1412,7 +1338,6 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
|
||||
tr->langopts.replace_chars = replace_cyrillic_latin;
|
||||
break;
|
||||
|
||||
case L('s', 'q'): // Albanian
|
||||
{
|
||||
static const short stress_lengths_sq[8] = { 150, 150, 180, 180, 0, 0, 300, 300 };
|
||||
@@ -1426,9 +1351,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_4;
|
||||
tr->langopts.accents = 2; // "capital" after letter name
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case L('s', 'v'): // Swedish
|
||||
{
|
||||
static const unsigned char stress_amps_sv[] = { 16, 16, 20, 20, 20, 22, 22, 21 };
|
||||
@@ -1440,8 +1363,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_1900;
|
||||
tr->langopts.accents = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('s', 'w'): // Swahili
|
||||
case L('t', 'n'): // Setswana
|
||||
{
|
||||
@@ -1460,8 +1382,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_OMIT_1_HUNDRED;
|
||||
tr->langopts.break_numbers = 0x49249268; // for languages which have numbers for 100,000 and 1,000,000
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('t', 'a'): // Tamil
|
||||
case L('k', 'n'): // Kannada
|
||||
case L('m', 'l'): // Malayalam
|
||||
@@ -1501,8 +1422,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetIndicLetters(tr); // call this after setting OFFSET_
|
||||
SetLetterBitsRange(tr, LETTERGP_B, 0x4e, 0x4e); // chillu-virama (unofficial)
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('t', 'r'): // Turkish
|
||||
case L('a', 'z'): // Azerbaijan
|
||||
{
|
||||
@@ -1523,8 +1443,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('t', 't'): // Tatar
|
||||
{
|
||||
SetCyrillicLetters(tr);
|
||||
@@ -1533,15 +1452,13 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_flags = S_NO_AUTO_2; // no automatic secondary stress
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_4;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('u', 'k'): // Ukrainian
|
||||
{
|
||||
SetCyrillicLetters(tr);
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('u', 'r'): // Urdu
|
||||
case L('s', 'd'): // Sindhi
|
||||
{
|
||||
@@ -1550,8 +1467,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_SWAP_TENS;
|
||||
tr->langopts.break_numbers = 0x52a8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('v', 'i'): // Vietnamese
|
||||
{
|
||||
static const short stress_lengths_vi[8] = { 150, 150, 180, 180, 210, 230, 230, 240 };
|
||||
@@ -1582,13 +1498,11 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND_DIGIT | NUM_DFRACTION_4 | NUM_ZERO_HUNDRED;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case L('w', 'o'):
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_SINGLE_STRESS;
|
||||
break;
|
||||
|
||||
case L('z', 'h'):
|
||||
case L_zhy:
|
||||
{
|
||||
@@ -1614,8 +1528,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.break_numbers = 0x00018;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
break;
|
||||
@@ -1627,7 +1540,6 @@ Translator *SelectTranslator(const char *name)
|
||||
return tr;
|
||||
}
|
||||
|
||||
|
||||
void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts)
|
||||
{
|
||||
if (langopts->numbers & NUM_DECIMAL_COMMA) {
|
||||
@@ -1639,7 +1551,6 @@ void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts)
|
||||
langopts->thousands_sep = 0; // don't allow thousands separator, except space
|
||||
}
|
||||
|
||||
|
||||
static void Translator_Russian(Translator *tr)
|
||||
{
|
||||
static const unsigned char stress_amps_ru[] = { 16, 16, 18, 18, 20, 24, 24, 22 };
|
||||
@@ -1660,5 +1571,4 @@ static void Translator_Russian(Translator *tr)
|
||||
tr->langopts.numbers2 = 0x2 + NUM2_THOUSANDS_VAR1; // variant numbers before thousands
|
||||
tr->langopts.phoneme_change = 1;
|
||||
tr->langopts.testing = 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#define WORD_STRESS_CHAR '*'
|
||||
|
||||
|
||||
Translator *translator = NULL; // the main translator
|
||||
Translator *translator2 = NULL; // secondary translator for certain words
|
||||
static char translator2_language[20] = { 0 };
|
||||
@@ -82,7 +81,6 @@ static int any_stressed_words;
|
||||
int pre_pause;
|
||||
ALPHABET *current_alphabet;
|
||||
|
||||
|
||||
// these were previously in translator class
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
char word_phonemes[N_WORD_PHONEMES*2]; // longer, because snprint() is not available
|
||||
@@ -92,8 +90,6 @@ char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
|
||||
int n_ph_list2;
|
||||
PHONEME_LIST2 ph_list2[N_PHONEME_LIST]; // first stage of text->phonemes
|
||||
|
||||
|
||||
|
||||
wchar_t option_punctlist[N_PUNCTLIST] = { 0 };
|
||||
char ctrl_embedded = '\001'; // to allow an alternative CTRL for embedded commands
|
||||
int option_multibyte = espeakCHARS_AUTO; // 0=auto, 1=utf8, 2=8bit, 3=wchar, 4=16bit
|
||||
@@ -112,7 +108,6 @@ static char source[N_TR_SOURCE+40]; // extra space for embedded command & vo
|
||||
int n_replace_phonemes;
|
||||
REPLACE_PHONEMES replace_phonemes[N_REPLACE_PHONEMES];
|
||||
|
||||
|
||||
// brackets, also 0x2014 to 0x021f which don't need to be in this list
|
||||
static const unsigned short brackets[] = {
|
||||
'(', ')', '[', ']', '{', '}', '<', '>', '"', '\'', '`',
|
||||
@@ -349,7 +344,6 @@ static unsigned char length_mods_equal[100] = {
|
||||
110, 120, 100, 110, 110, 110, 110, 110, 110, 110
|
||||
};
|
||||
|
||||
|
||||
static unsigned char *length_mod_tabs[6] = {
|
||||
length_mods_en,
|
||||
length_mods_en, // 1
|
||||
@@ -359,7 +353,6 @@ static unsigned char *length_mod_tabs[6] = {
|
||||
length_mods_equal // 5
|
||||
};
|
||||
|
||||
|
||||
void SetLengthMods(Translator *tr, int value)
|
||||
{
|
||||
int value2;
|
||||
@@ -369,8 +362,6 @@ void SetLengthMods(Translator *tr, int value)
|
||||
tr->langopts.length_mods0 = length_mod_tabs[value2];
|
||||
}
|
||||
|
||||
|
||||
|
||||
int IsAlpha(unsigned int c)
|
||||
{
|
||||
// Replacement for iswalph() which also checks for some in-word symbols
|
||||
@@ -457,7 +448,6 @@ int IsSpace(unsigned int c)
|
||||
return iswspace(c);
|
||||
}
|
||||
|
||||
|
||||
void DeleteTranslator(Translator *tr)
|
||||
{
|
||||
if (tr->data_dictlist != NULL)
|
||||
@@ -465,7 +455,6 @@ void DeleteTranslator(Translator *tr)
|
||||
Free(tr);
|
||||
}
|
||||
|
||||
|
||||
int lookupwchar(const unsigned short *list, int c)
|
||||
{
|
||||
// Is the character c in the list ?
|
||||
@@ -478,7 +467,6 @@ int lookupwchar(const unsigned short *list, int c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int lookupwchar2(const unsigned short *list, int c)
|
||||
{
|
||||
// Replace character c by another character.
|
||||
@@ -492,7 +480,6 @@ int lookupwchar2(const unsigned short *list, int c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int IsBracket(int c)
|
||||
{
|
||||
if ((c >= 0x2014) && (c <= 0x201f))
|
||||
@@ -500,7 +487,6 @@ int IsBracket(int c)
|
||||
return lookupwchar(brackets, c);
|
||||
}
|
||||
|
||||
|
||||
int utf8_out(unsigned int c, char *buf)
|
||||
{
|
||||
// write a unicode character into a buffer as utf8
|
||||
@@ -534,7 +520,6 @@ int utf8_out(unsigned int c, char *buf)
|
||||
return n_bytes+1;
|
||||
}
|
||||
|
||||
|
||||
int utf8_nbytes(const char *buf)
|
||||
{
|
||||
// Returns the number of bytes for the first UTF-8 character in buf
|
||||
@@ -548,7 +533,6 @@ int utf8_nbytes(const char *buf)
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
int utf8_in2(int *c, const char *buf, int backwards)
|
||||
{
|
||||
// Read a unicode characater from a UTF8 string
|
||||
@@ -586,7 +570,6 @@ int utf8_in2(int *c, const char *buf, int backwards)
|
||||
return n_bytes+1;
|
||||
}
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
int utf8_in(int *c, const char *buf)
|
||||
{
|
||||
@@ -596,7 +579,6 @@ int utf8_in(int *c, const char *buf)
|
||||
}
|
||||
#pragma GCC visibility pop
|
||||
|
||||
|
||||
char *strchr_w(const char *s, int c)
|
||||
{
|
||||
// return NULL for any non-ascii character
|
||||
@@ -605,7 +587,6 @@ char *strchr_w(const char *s, int c)
|
||||
return strchr((char *)s, c); // (char *) is needed for Borland compiler
|
||||
}
|
||||
|
||||
|
||||
int IsAllUpper(const char *word)
|
||||
{
|
||||
int c;
|
||||
@@ -617,7 +598,6 @@ int IsAllUpper(const char *word)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word)
|
||||
{
|
||||
int posn = 0;
|
||||
@@ -643,8 +623,6 @@ static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes,
|
||||
return word;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int CheckDottedAbbrev(char *word1, WORD_TAB *wtab)
|
||||
{
|
||||
int wc;
|
||||
@@ -701,7 +679,6 @@ static int CheckDottedAbbrev(char *word1, WORD_TAB *wtab)
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
extern char *phondata_ptr;
|
||||
|
||||
int ChangeEquivalentPhonemes(Translator *tr, int lang2, char *phonemes)
|
||||
@@ -783,9 +760,6 @@ int ChangeEquivalentPhonemes(Translator *tr, int lang2, char *phonemes)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wtab, char *word_out)
|
||||
{
|
||||
// word1 is terminated by space (0x20) character
|
||||
@@ -908,7 +882,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if (!found)
|
||||
found = LookupDictList(tr, &word1, phonemes, dictionary_flags, FLAG_ALLOW_TEXTMODE, wtab); // the original word
|
||||
|
||||
|
||||
if ((dictionary_flags[0] & (FLAG_ALLOW_DOT | FLAG_NEEDS_DOT)) && (wordx[1] == '.'))
|
||||
wordx[1] = ' '; // remove a Dot after this word
|
||||
|
||||
@@ -951,7 +924,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if textmode, LookupDictList() replaces word1 by the new text and returns found=0
|
||||
|
||||
if (phonemes[0] == phonSWITCH) {
|
||||
@@ -1196,9 +1168,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ((end_type != 0) && !(end_type & SUFX_P)) {
|
||||
end_type1 = end_type;
|
||||
strcpy(phonemes2, phonemes);
|
||||
@@ -1293,9 +1262,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
memcpy(wordx, word_copy, strlen(word_copy));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
wordx[-1] = c_temp;
|
||||
}
|
||||
}
|
||||
@@ -1312,7 +1278,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
|
||||
wflags |= emphasize_allcaps;
|
||||
|
||||
|
||||
/* determine stress pattern for this word */
|
||||
/******************************************/
|
||||
add_suffix_phonemes = 0;
|
||||
@@ -1400,7 +1365,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
ChangeWordStress(tr, word_phonemes, 3);
|
||||
}
|
||||
|
||||
|
||||
// dictionary flags for this word give a clue about which alternative pronunciations of
|
||||
// following words to use.
|
||||
if (end_type1 & SUFX_F) {
|
||||
@@ -1461,8 +1425,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
return dictionary_flags[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetPlist2(PHONEME_LIST2 *p, unsigned char phcode)
|
||||
{
|
||||
p->phcode = phcode;
|
||||
@@ -1484,7 +1446,6 @@ static int CountSyllables(unsigned char *phonemes)
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void Word_EmbeddedCmd()
|
||||
{
|
||||
// Process embedded commands for emphasis, sayas, and break
|
||||
@@ -1516,7 +1477,6 @@ void Word_EmbeddedCmd()
|
||||
} while (((embedded_cmd & 0x80) == 0) && (embedded_read < embedded_ix));
|
||||
}
|
||||
|
||||
|
||||
int SetTranslator2(const char *new_language)
|
||||
{
|
||||
// Set translator2 to a second language
|
||||
@@ -1569,8 +1529,6 @@ int SetTranslator2(const char *new_language)
|
||||
return new_phoneme_tab;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pause, int next_pause)
|
||||
{
|
||||
int flags = 0;
|
||||
@@ -2020,8 +1978,6 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int EmbeddedCommand(unsigned int *source_index_out)
|
||||
{
|
||||
// An embedded command to change the pitch, volume, etc.
|
||||
@@ -2079,8 +2035,6 @@ static int EmbeddedCommand(unsigned int *source_index_out)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in, int *insert, int *wordflags)
|
||||
{
|
||||
int ix;
|
||||
@@ -2139,10 +2093,8 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
|
||||
|
||||
*wordflags |= FLAG_CHAR_REPLACED;
|
||||
return new_c;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c, unsigned int next_in, int *insert, int *wordflags)
|
||||
{
|
||||
// To allow language specific examination and replacement of characters
|
||||
@@ -2192,7 +2144,6 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
|
||||
case L('n', 'l'):
|
||||
// look for 'n and replace by a special character (unicode: schwa)
|
||||
|
||||
|
||||
if (!iswalpha2(prev_in)) {
|
||||
utf8_in(&next2, &ptr[1]);
|
||||
|
||||
@@ -2213,7 +2164,6 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
|
||||
return SubstituteChar(tr, c, next_in, insert, wordflags);
|
||||
}
|
||||
|
||||
|
||||
static const char *UCase_ga[] = { "bp", "bhf", "dt", "gc", "hA", "mb", "nd", "ng", "ts", "tA", "nA", NULL };
|
||||
|
||||
int UpperCaseInWord(Translator *tr, char *word, int c)
|
||||
@@ -2238,7 +2188,6 @@ int UpperCaseInWord(Translator *tr, char *word, int c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *tone_out, char **voice_change)
|
||||
{
|
||||
int ix;
|
||||
@@ -2820,7 +2769,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
}
|
||||
words[0].flags |= FLAG_FIRST_WORD;
|
||||
|
||||
|
||||
for (ix = 0; ix < word_count; ix++) {
|
||||
int nx;
|
||||
int c_temp;
|
||||
@@ -2989,7 +2937,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
embedded_list[embedded_ix] = 0x80;
|
||||
}
|
||||
|
||||
|
||||
prev_clause_pause = clause_pause;
|
||||
|
||||
if (tone_out != NULL)
|
||||
@@ -2999,7 +2946,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
if (terminator & CLAUSE_BIT_SENTENCE)
|
||||
new_sentence = 1; // next clause is a new sentence
|
||||
|
||||
|
||||
if (voice_change != NULL) {
|
||||
// return new voice name if an embedded voice change command terminated the clause
|
||||
if (terminator & CLAUSE_BIT_VOICE)
|
||||
@@ -3017,10 +2963,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
return (void *)p_textinput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitText(int control)
|
||||
{
|
||||
count_sentences = 0;
|
||||
|
||||
+6
-103
@@ -46,7 +46,6 @@
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
MNEM_TAB genders[] = {
|
||||
{ "unknown", 0 },
|
||||
{ "male", 1 },
|
||||
@@ -60,8 +59,6 @@ int tone_points[12] = { 600, 170, 1200, 135, 2000, 110, 3000, 110, -1, 0 };
|
||||
static int formant_rate_22050[9] = { 240, 170, 170, 170, 170, 170, 170, 170, 170 }; // values for 22kHz sample rate
|
||||
int formant_rate[9]; // values adjusted for actual sample rate
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_LANGUAGE_PRIORITY 5
|
||||
#define N_VOICES_LIST 250
|
||||
static int n_voices_list = 0;
|
||||
@@ -70,7 +67,6 @@ static int len_path_voices;
|
||||
|
||||
espeak_VOICE current_voice_selected;
|
||||
|
||||
|
||||
enum {
|
||||
V_NAME = 1,
|
||||
V_LANGUAGE,
|
||||
@@ -118,8 +114,6 @@ enum {
|
||||
V_CONSONANTS
|
||||
};
|
||||
|
||||
|
||||
|
||||
static MNEM_TAB options_tab[] = {
|
||||
{ "reduce_t", LOPT_REDUCE_T },
|
||||
{ "bracket", LOPT_BRACKET_PAUSE },
|
||||
@@ -183,7 +177,6 @@ static MNEM_TAB dict_dialects[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
||||
#define N_VOICE_VARIANTS 12
|
||||
const char variants_either[N_VOICE_VARIANTS] = { 1, 2, 12, 3, 13, 4, 14, 5, 11, 0 };
|
||||
const char variants_male[N_VOICE_VARIANTS] = { 1, 2, 3, 4, 5, 6, 0 };
|
||||
@@ -193,7 +186,6 @@ const char *variant_lists[3] = { variants_either, variants_male, variants_female
|
||||
static voice_t voicedata;
|
||||
voice_t *voice = &voicedata;
|
||||
|
||||
|
||||
static char *fgets_strip(char *buf, int size, FILE *f_in)
|
||||
{
|
||||
// strip trailing spaces, and truncate lines at // comment
|
||||
@@ -218,7 +210,6 @@ static char *fgets_strip(char *buf, int size, FILE *f_in)
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static int LookupTune(const char *name)
|
||||
{
|
||||
int ix;
|
||||
@@ -230,8 +221,6 @@ static int LookupTune(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetToneAdjust(voice_t *voice, int *tone_pts)
|
||||
{
|
||||
int ix;
|
||||
@@ -266,7 +255,6 @@ static void SetToneAdjust(voice_t *voice, int *tone_pts)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ReadTonePoints(char *string, int *tone_pts)
|
||||
{
|
||||
// tone_pts[] is int[12]
|
||||
@@ -281,9 +269,6 @@ void ReadTonePoints(char *string, int *tone_pts)
|
||||
&tone_pts[8], &tone_pts[9]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *leafname)
|
||||
{
|
||||
// Read a Voice file, allocate a VOICE_DATA and set data from the
|
||||
@@ -295,7 +280,6 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *le
|
||||
char vlanguage[80];
|
||||
char languages[300]; // allow space for several alternate language names and priorities
|
||||
|
||||
|
||||
unsigned int len;
|
||||
int langix = 0;
|
||||
int n_languages = 0;
|
||||
@@ -378,9 +362,6 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *le
|
||||
return voice_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void VoiceReset(int tone_only)
|
||||
{
|
||||
// Set voice to the default values
|
||||
@@ -449,7 +430,6 @@ void VoiceReset(int tone_only)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void VoiceFormant(char *p)
|
||||
{
|
||||
// Set parameters for a formant
|
||||
@@ -476,10 +456,6 @@ static void VoiceFormant(char *p)
|
||||
voice->freqadd[formant] = freqadd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void PhonemeReplacement(int type, char *p)
|
||||
{
|
||||
int n;
|
||||
@@ -501,8 +477,6 @@ static void PhonemeReplacement(int type, char *p)
|
||||
replace_phonemes[n_replace_phonemes++].type = flags;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int Read8Numbers(char *data_in, int *data)
|
||||
{
|
||||
// Read 8 integer numbers
|
||||
@@ -511,7 +485,6 @@ static int Read8Numbers(char *data_in, int *data)
|
||||
&data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7]);
|
||||
}
|
||||
|
||||
|
||||
static unsigned int StringToWord2(const char *string)
|
||||
{
|
||||
// Convert a language name string to a word such as L('e','n')
|
||||
@@ -524,7 +497,6 @@ static unsigned int StringToWord2(const char *string)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
voice_t *LoadVoice(const char *vname, int control)
|
||||
{
|
||||
// control, bit 0 1= no_default
|
||||
@@ -583,7 +555,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
static const char *voices_europe =
|
||||
"an bg bs ca cs cy da de el en en-us es et eu fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
|
||||
|
||||
strncpy0(voicename, vname, sizeof(voicename));
|
||||
if (control & 0x10) {
|
||||
strcpy(buf, vname);
|
||||
@@ -639,7 +610,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
strcpy(new_dictionary, language_type);
|
||||
strcpy(phonemes_name, language_type);
|
||||
|
||||
|
||||
if (!tone_only) {
|
||||
voice = &voicedata;
|
||||
strncpy0(voice_identifier, vname, sizeof(voice_identifier));
|
||||
@@ -662,7 +632,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
if (!tone_only)
|
||||
SelectPhonemeTableName(phonemes_name); // set up phoneme_tab
|
||||
|
||||
|
||||
while ((f_voice != NULL) && (fgets_strip(buf, sizeof(buf), f_voice) != NULL)) {
|
||||
// isolate the attribute name
|
||||
for (p = buf; (*p != 0) && !isspace(*p); p++) ;
|
||||
@@ -715,15 +684,13 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
strncpy0(voice->language_name, language_name, sizeof(voice->language_name));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_NAME:
|
||||
if (tone_only == 0) {
|
||||
while (isspace(*p)) p++;
|
||||
strncpy0(voice_name, p, sizeof(voice_name));
|
||||
}
|
||||
break;
|
||||
|
||||
case V_GENDER:
|
||||
{
|
||||
int age = 0;
|
||||
@@ -732,8 +699,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
current_voice_selected.gender = LookupMnem(genders, vgender);
|
||||
current_voice_selected.age = age;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_TRANSLATOR:
|
||||
if (tone_only) break;
|
||||
|
||||
@@ -745,19 +711,15 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
new_translator = SelectTranslator(translator_name);
|
||||
langopts = &new_translator->langopts;
|
||||
break;
|
||||
|
||||
case V_DICTIONARY: // dictionary
|
||||
sscanf(p, "%s", new_dictionary);
|
||||
break;
|
||||
|
||||
case V_PHONEMES: // phoneme table
|
||||
sscanf(p, "%s", phonemes_name);
|
||||
break;
|
||||
|
||||
case V_FORMANT:
|
||||
VoiceFormant(p);
|
||||
break;
|
||||
|
||||
case V_PITCH:
|
||||
{
|
||||
double factor;
|
||||
@@ -768,26 +730,21 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
factor = (double)(pitch1 - 82)/82;
|
||||
voice->formant_factor = (int)((1+factor/4) * 256); // nominal formant shift for a different voice pitch
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_STRESSLENGTH: // stressLength
|
||||
stress_lengths_set = Read8Numbers(p, stress_lengths);
|
||||
break;
|
||||
|
||||
case V_STRESSAMP: // stressAmp
|
||||
stress_amps_set = Read8Numbers(p, stress_amps);
|
||||
break;
|
||||
|
||||
case V_STRESSADD: // stressAdd
|
||||
stress_add_set = Read8Numbers(p, stress_add);
|
||||
break;
|
||||
|
||||
case V_INTONATION: // intonation
|
||||
sscanf(p, "%d %d", &option_tone_flags, &option_tone2);
|
||||
if ((option_tone_flags & 0xff) != 0)
|
||||
langopts->intonation_group = option_tone_flags & 0xff;
|
||||
break;
|
||||
|
||||
case V_TUNES:
|
||||
n = sscanf(p, "%s %s %s %s %s %s", names[0], names[1], names[2], names[3], names[4], names[5]);
|
||||
langopts->intonation_group = 0;
|
||||
@@ -801,7 +758,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
langopts->tunes[ix] = value;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_DICTRULES: // conditional dictionary rules and list entries
|
||||
case V_NUMBERS:
|
||||
case V_STRESSOPT:
|
||||
@@ -829,7 +785,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
}
|
||||
ProcessLanguageOptions(langopts);
|
||||
break;
|
||||
|
||||
case V_REPLACE:
|
||||
if (phonemes_set == 0) {
|
||||
// must set up a phoneme table before we can lookup phoneme mnemonics
|
||||
@@ -838,23 +793,19 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
}
|
||||
PhonemeReplacement(key, p);
|
||||
break;
|
||||
|
||||
case V_WORDGAP: // words
|
||||
sscanf(p, "%d %d", &langopts->word_gap, &langopts->vowel_pause);
|
||||
break;
|
||||
|
||||
case V_STRESSRULE:
|
||||
sscanf(p, "%d %d %d %d", &langopts->stress_rule,
|
||||
&langopts->stress_flags,
|
||||
&langopts->unstressed_wd1,
|
||||
&langopts->unstressed_wd2);
|
||||
break;
|
||||
|
||||
case V_CHARSET:
|
||||
if ((sscanf(p, "%d", &value) == 1) && (value < N_CHARSETS))
|
||||
new_translator->charset_a0 = charsets[value];
|
||||
break;
|
||||
|
||||
case V_OPTION:
|
||||
value2 = 0;
|
||||
if (((sscanf(p, "%s %d %d", option_name, &value, &value2) >= 2) && ((ix = LookupMnem(options_tab, option_name)) >= 0)) ||
|
||||
@@ -864,24 +815,20 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
} else
|
||||
fprintf(stderr, "Bad voice option: %s %s\n", buf, p);
|
||||
break;
|
||||
|
||||
case V_ECHO:
|
||||
// echo. suggest: 135mS 11%
|
||||
value = 0;
|
||||
voice->echo_amp = 0;
|
||||
sscanf(p, "%d %d", &voice->echo_delay, &voice->echo_amp);
|
||||
break;
|
||||
|
||||
case V_FLUTTER: // flutter
|
||||
if (sscanf(p, "%d", &value) == 1)
|
||||
voice->flutter = value * 32;
|
||||
break;
|
||||
|
||||
case V_ROUGHNESS: // roughness
|
||||
if (sscanf(p, "%d", &value) == 1)
|
||||
voice->roughness = value;
|
||||
break;
|
||||
|
||||
case V_CLARITY: // formantshape
|
||||
if (sscanf(p, "%d", &value) == 1) {
|
||||
if (value > 4) {
|
||||
@@ -891,20 +838,17 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
voice->n_harmonic_peaks = 1+value;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_TONE:
|
||||
{
|
||||
int tone_data[12];
|
||||
ReadTonePoints(p, tone_data);
|
||||
SetToneAdjust(voice, tone_data);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_VOICING:
|
||||
if (sscanf(p, "%d", &value) == 1)
|
||||
voice->voicing = (value * 64)/100;
|
||||
break;
|
||||
|
||||
case V_BREATH:
|
||||
voice->breath[0] = Read8Numbers(p, &voice->breath[1]);
|
||||
for (ix = 1; ix < 8; ix++) {
|
||||
@@ -912,19 +856,15 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
voice->breath[ix] = -voice->breath[ix];
|
||||
}
|
||||
break;
|
||||
|
||||
case V_BREATHW:
|
||||
voice->breathw[0] = Read8Numbers(p, &voice->breathw[1]);
|
||||
break;
|
||||
|
||||
case V_CONSONANTS:
|
||||
value = sscanf(p, "%d %d", &voice->consonant_amp, &voice->consonant_ampv);
|
||||
break;
|
||||
|
||||
case V_SPEED:
|
||||
sscanf(p, "%d", &voice->speed_percent);
|
||||
break;
|
||||
|
||||
case V_MBROLA:
|
||||
{
|
||||
int srate = 16000;
|
||||
@@ -936,23 +876,19 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
}
|
||||
voice->samplerate = srate;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_KLATT:
|
||||
voice->klattv[0] = 1; // default source: IMPULSIVE
|
||||
Read8Numbers(p, voice->klattv);
|
||||
voice->klattv[KLATT_Kopen] -= 40;
|
||||
break;
|
||||
|
||||
case V_FAST:
|
||||
Read8Numbers(p, speed.fast_settings);
|
||||
SetSpeed(3);
|
||||
break;
|
||||
|
||||
case V_DICTMIN:
|
||||
sscanf(p, "%d", &dict_min);
|
||||
break;
|
||||
|
||||
case V_ALPHABET2:
|
||||
{
|
||||
ALPHABET *alphabet;
|
||||
@@ -967,8 +903,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
} else
|
||||
fprintf(stderr, "alphabet name '%s' not found\n", name1);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case V_DICTDIALECT:
|
||||
// specify a dialect to use for foreign words, eg, en-us for _^_EN
|
||||
if (sscanf(p, "%s", name1) == 1) {
|
||||
@@ -978,7 +913,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
fprintf(stderr, "dictdialect name '%s' not recognized\n", name1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((key & 0xff00) == 0x100)
|
||||
sscanf(p, "%d", &langopts->param[key &0xff]);
|
||||
@@ -1049,7 +983,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
return voice;
|
||||
}
|
||||
|
||||
|
||||
static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir)
|
||||
{
|
||||
// Remove any voice variant suffix (name or number) from a voice name
|
||||
@@ -1088,8 +1021,6 @@ static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir)
|
||||
return variant_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
voice_t *LoadVoiceVariant(const char *vname, int variant_num)
|
||||
{
|
||||
// Load a voice file.
|
||||
@@ -1110,15 +1041,12 @@ voice_t *LoadVoiceVariant(const char *vname, int variant_num)
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int __cdecl VoiceNameSorter(const void *p1, const void *p2)
|
||||
{
|
||||
int ix;
|
||||
espeak_VOICE *v1 = *(espeak_VOICE **)p1;
|
||||
espeak_VOICE *v2 = *(espeak_VOICE **)p2;
|
||||
|
||||
|
||||
if ((ix = strcmp(&v1->languages[1], &v2->languages[1])) != 0) // primary language name
|
||||
return ix;
|
||||
if ((ix = v1->languages[0] - v2->languages[0]) != 0) // priority number
|
||||
@@ -1126,7 +1054,6 @@ static int __cdecl VoiceNameSorter(const void *p1, const void *p2)
|
||||
return strcmp(v1->name, v2->name);
|
||||
}
|
||||
|
||||
|
||||
static int __cdecl VoiceScoreSorter(const void *p1, const void *p2)
|
||||
{
|
||||
int ix;
|
||||
@@ -1138,7 +1065,6 @@ static int __cdecl VoiceScoreSorter(const void *p1, const void *p2)
|
||||
return strcmp(v1->name, v2->name);
|
||||
}
|
||||
|
||||
|
||||
static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int spec_n_parts, int spec_lang_len, espeak_VOICE *voice)
|
||||
{
|
||||
int ix;
|
||||
@@ -1262,7 +1188,6 @@ static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int s
|
||||
return score;
|
||||
}
|
||||
|
||||
|
||||
static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int control)
|
||||
{
|
||||
// control: bit0=1 include mbrola voices
|
||||
@@ -1298,7 +1223,6 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
language[lang_len] = 0;
|
||||
n_parts = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// select those voices which match the specified language
|
||||
@@ -1325,9 +1249,6 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
return nv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name2)
|
||||
{
|
||||
int ix;
|
||||
@@ -1380,9 +1301,6 @@ espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name2)
|
||||
return voices[match_name];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char const *SelectVoice(espeak_VOICE *voice_select, int *found)
|
||||
{
|
||||
// Returns a path within espeak-voices, with a possible +variant suffix
|
||||
@@ -1513,8 +1431,6 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found)
|
||||
return vp->identifier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GetVoices(const char *path)
|
||||
{
|
||||
FILE *f_voice;
|
||||
@@ -1600,7 +1516,6 @@ static void GetVoices(const char *path)
|
||||
}
|
||||
} while (FindNextFileA(hFind, &FindFileData) != 0);
|
||||
FindClose(hFind);
|
||||
|
||||
#else
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
@@ -1640,8 +1555,6 @@ static void GetVoices(const char *path)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
espeak_ERROR SetVoiceByName(const char *name)
|
||||
{
|
||||
espeak_VOICE *v;
|
||||
@@ -1692,8 +1605,6 @@ espeak_ERROR SetVoiceByName(const char *name)
|
||||
return EE_INTERNAL_ERROR; // voice name not found
|
||||
}
|
||||
|
||||
|
||||
|
||||
espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
{
|
||||
const char *voice_id;
|
||||
@@ -1711,7 +1622,6 @@ espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
return EE_OK;
|
||||
}
|
||||
|
||||
|
||||
void FreeVoiceList()
|
||||
{
|
||||
int ix;
|
||||
@@ -1724,15 +1634,12 @@ void FreeVoiceList()
|
||||
n_voices_list = 0;
|
||||
}
|
||||
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
|
||||
ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
{
|
||||
char path_voices[sizeof(path_home)+12];
|
||||
|
||||
|
||||
#ifdef PLATFORM_RISCOS
|
||||
if (n_voices_list == 0) {
|
||||
sprintf(path_voices, "%s%cvoices", path_home, PATHSEP);
|
||||
@@ -1741,7 +1648,6 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
voices_list[n_voices_list] = NULL; // voices list terminator
|
||||
}
|
||||
return (const espeak_VOICE **)voices_list;
|
||||
|
||||
#else
|
||||
int ix;
|
||||
int j;
|
||||
@@ -1762,7 +1668,6 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
qsort(voices_list, n_voices_list, sizeof(espeak_VOICE *),
|
||||
(int(__cdecl *)(const void *, const void *))VoiceNameSorter);
|
||||
|
||||
|
||||
if (voice_spec) {
|
||||
// select the voices which match the voice_spec, and sort them by preference
|
||||
SetVoiceScores(voice_spec, voices, 1);
|
||||
@@ -1780,8 +1685,6 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void)
|
||||
{
|
||||
return ¤t_voice_selected;
|
||||
|
||||
@@ -50,7 +50,6 @@ struct timespec {
|
||||
};
|
||||
#endif /* HAVE_STRUCT_TIMESPEC */
|
||||
|
||||
|
||||
enum { ONE_BILLION = 1000000000 };
|
||||
|
||||
#ifdef USE_PORTAUDIO
|
||||
@@ -64,9 +63,6 @@ enum { ONE_BILLION = 1000000000 };
|
||||
#define USE_PORTAUDIO 18
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef USE_PULSEAUDIO
|
||||
// create some wrappers for runtime detection
|
||||
|
||||
@@ -206,7 +202,6 @@ int wave_get_remaining_time(uint32_t sample, uint32_t *time)
|
||||
|
||||
#endif // USE_PULSEAUDIO
|
||||
|
||||
|
||||
static t_wave_callback *my_callback_is_output_enabled = NULL;
|
||||
|
||||
#define N_WAV_BUF 10
|
||||
@@ -392,7 +387,6 @@ static int pa_callback(const void *inputBuffer, void *outputBuffer,
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
||||
void wave_flush(void *theHandler)
|
||||
{
|
||||
ENTER("wave_flush");
|
||||
@@ -421,7 +415,6 @@ static int wave_open_sound()
|
||||
out_channels = 1;
|
||||
|
||||
#if USE_PORTAUDIO == 18
|
||||
|
||||
PaDeviceID playbackDevice = Pa_GetDefaultOutputDeviceID();
|
||||
|
||||
PaError err = Pa_OpenStream(&pa_stream,
|
||||
@@ -892,7 +885,6 @@ int wave_is_busy(void *theHandler)
|
||||
|
||||
SHOW("wave_is_busy: %d\n", active);
|
||||
|
||||
|
||||
return active == 1;
|
||||
}
|
||||
|
||||
@@ -901,7 +893,6 @@ void wave_terminate()
|
||||
ENTER("wave_terminate");
|
||||
|
||||
Pa_Terminate();
|
||||
|
||||
}
|
||||
|
||||
uint32_t wave_get_read_position(void *theHandler)
|
||||
@@ -944,10 +935,8 @@ void *wave_test_get_write_buffer()
|
||||
return myWrite;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
int wave_init(int srate) {
|
||||
return 1;
|
||||
}
|
||||
@@ -1015,5 +1004,4 @@ void add_time_in_ms(struct timespec *ts, int time_in_ms)
|
||||
ts->tv_nsec = (long int)t_ns;
|
||||
}
|
||||
|
||||
|
||||
#endif // USE_ASYNC
|
||||
|
||||
@@ -161,7 +161,6 @@ static void context_state_cb(pa_context *c, void *userdata) {
|
||||
case PA_CONTEXT_FAILED:
|
||||
pa_threaded_mainloop_signal(mainloop, 0);
|
||||
break;
|
||||
|
||||
case PA_CONTEXT_UNCONNECTED:
|
||||
case PA_CONTEXT_CONNECTING:
|
||||
case PA_CONTEXT_AUTHORIZING:
|
||||
@@ -176,13 +175,11 @@ static void stream_state_cb(pa_stream *s, void *userdata) {
|
||||
|
||||
switch (pa_stream_get_state(s))
|
||||
{
|
||||
|
||||
case PA_STREAM_READY:
|
||||
case PA_STREAM_FAILED:
|
||||
case PA_STREAM_TERMINATED:
|
||||
pa_threaded_mainloop_signal(mainloop, 0);
|
||||
break;
|
||||
|
||||
case PA_STREAM_UNCONNECTED:
|
||||
case PA_STREAM_CREATING:
|
||||
break;
|
||||
@@ -312,7 +309,6 @@ fail:
|
||||
static void pulse_write(void *ptr, int length) {
|
||||
ENTER(__FUNCTION__);
|
||||
|
||||
|
||||
SHOW("pulse_write > length=%d\n", length);
|
||||
|
||||
CHECK_CONNECTED_NO_RETVAL();
|
||||
@@ -327,9 +323,7 @@ static void pulse_write(void *ptr, int length) {
|
||||
|
||||
do_trigger = 0;
|
||||
written += length;
|
||||
|
||||
fail:
|
||||
|
||||
pa_threaded_mainloop_unlock(mainloop);
|
||||
}
|
||||
|
||||
@@ -362,7 +356,6 @@ static int drain(void) {
|
||||
SHOW("pa_stream_drain() failed: %s\n", pa_strerror(pa_context_errno(context)));
|
||||
else
|
||||
ret = PULSE_OK;
|
||||
|
||||
fail:
|
||||
SHOW_TIME("pa_operation_unref (call)");
|
||||
if (o)
|
||||
@@ -374,7 +367,6 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void pulse_close(void) {
|
||||
|
||||
ENTER(__FUNCTION__);
|
||||
@@ -404,7 +396,6 @@ static void pulse_close(void) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int pulse_open()
|
||||
{
|
||||
ENTER(__FUNCTION__);
|
||||
@@ -533,16 +524,12 @@ static int pulse_open()
|
||||
SHOW_TIME("pulse_open (ret true)");
|
||||
|
||||
return PULSE_OK;
|
||||
|
||||
unlock_and_fail:
|
||||
|
||||
if (o)
|
||||
pa_operation_unref(o);
|
||||
|
||||
pa_threaded_mainloop_unlock(mainloop);
|
||||
|
||||
fail:
|
||||
|
||||
if (ret == PULSE_NO_CONNECTION) {
|
||||
if (context) {
|
||||
SHOW_TIME("pa_context_disconnect (call)");
|
||||
@@ -562,7 +549,6 @@ fail:
|
||||
SHOW_TIME("pulse_open (ret false)");
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
void wave_flush(void *theHandler)
|
||||
@@ -634,7 +620,6 @@ size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSiz
|
||||
}
|
||||
|
||||
pulse_write(aBuffer, bytes_to_write);
|
||||
|
||||
terminate:
|
||||
pthread_mutex_unlock(&pulse_mutex);
|
||||
SHOW("wave_write: theSize=%d", theSize);
|
||||
@@ -745,10 +730,8 @@ void *wave_test_get_write_buffer()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
int wave_init(return 1; ) {
|
||||
}
|
||||
void *wave_open(const char *the_api) {
|
||||
@@ -818,5 +801,4 @@ void add_time_in_ms(struct timespec *ts, int time_in_ms)
|
||||
}
|
||||
#endif // ifndef USE_PORTAUDIO
|
||||
|
||||
|
||||
#endif // USE_ASYNC
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "speak_lib.h"
|
||||
#include "speech.h"
|
||||
#include "phoneme.h"
|
||||
@@ -56,7 +54,6 @@
|
||||
#define N_SINTAB 2048
|
||||
#include "sintab.h"
|
||||
|
||||
|
||||
#define PI 3.1415927
|
||||
#define PI2 6.283185307
|
||||
#define N_WAV_BUF 10
|
||||
@@ -94,7 +91,6 @@ static RESONATOR rbreath[N_PEAKS];
|
||||
|
||||
static int harm_sqrt_n = 0;
|
||||
|
||||
|
||||
#define N_LOWHARM 30
|
||||
static int harm_inc[N_LOWHARM]; // only for these harmonics do we interpolate amplitude between steps
|
||||
static int *harmspect;
|
||||
@@ -107,7 +103,6 @@ static int modulation_type = 0;
|
||||
static int glottal_flag = 0;
|
||||
static int glottal_reduce = 0;
|
||||
|
||||
|
||||
WGEN_DATA wdata;
|
||||
|
||||
static int amp_ix;
|
||||
@@ -126,7 +121,6 @@ static int hf_factor;
|
||||
static double minus_pi_t;
|
||||
static double two_pi_t;
|
||||
|
||||
|
||||
unsigned char *out_ptr;
|
||||
unsigned char *out_start;
|
||||
unsigned char *out_end;
|
||||
@@ -248,7 +242,6 @@ static unsigned char wavemult[N_WAVEMULT] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
// set from y = pow(2,x) * 128, x=-1 to 1
|
||||
unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1] = {
|
||||
64, 65, 66, 67, 68, 69, 70, 71,
|
||||
@@ -266,7 +259,6 @@ unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1] = {
|
||||
242, 246, 249, 252, 254, 255
|
||||
};
|
||||
|
||||
|
||||
void WcmdqStop()
|
||||
{
|
||||
wcmdq_head = 0;
|
||||
@@ -286,7 +278,6 @@ void WcmdqStop()
|
||||
MbrolaReset();
|
||||
}
|
||||
|
||||
|
||||
int WcmdqFree()
|
||||
{
|
||||
int i;
|
||||
@@ -300,7 +291,6 @@ int WcmdqUsed()
|
||||
return N_WCMDQ - WcmdqFree();
|
||||
}
|
||||
|
||||
|
||||
void WcmdqInc()
|
||||
{
|
||||
wcmdq_tail++;
|
||||
@@ -313,8 +303,6 @@ static void WcmdqIncHead()
|
||||
if (wcmdq_head >= N_WCMDQ) wcmdq_head = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define PEAKSHAPEW 256
|
||||
|
||||
unsigned char pk_shape1[PEAKSHAPEW+1] = {
|
||||
@@ -359,7 +347,6 @@ static unsigned char pk_shape2[PEAKSHAPEW+1] = {
|
||||
|
||||
static unsigned char *pk_shape;
|
||||
|
||||
|
||||
#ifdef USE_PORTAUDIO
|
||||
// PortAudio interface
|
||||
|
||||
@@ -370,7 +357,6 @@ static int out_channels = 1;
|
||||
unsigned char *outbuffer = NULL;
|
||||
int outbuffer_size = 0;
|
||||
|
||||
|
||||
#if USE_PORTAUDIO == 18
|
||||
static int WaveCallback(void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer, PaTimestamp outTime, void *userData)
|
||||
@@ -486,10 +472,8 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer,
|
||||
#else
|
||||
return result;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if USE_PORTAUDIO == 19
|
||||
/* This is a fixed version of Pa_OpenDefaultStream() for use if the version in portaudio V19
|
||||
is broken */
|
||||
@@ -532,7 +516,6 @@ static PaError Pa_OpenDefaultStream2(PaStream **stream,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int WavegenOpenSound()
|
||||
{
|
||||
PaError err, err2;
|
||||
@@ -590,8 +573,6 @@ int WavegenOpenSound()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int WavegenCloseSound()
|
||||
{
|
||||
PaError active;
|
||||
@@ -615,7 +596,6 @@ int WavegenCloseSound()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int WavegenInitSound()
|
||||
{
|
||||
PaError err;
|
||||
@@ -647,7 +627,6 @@ int WavegenInitSound()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void WavegenInit(int rate, int wavemult_fact)
|
||||
{
|
||||
int ix;
|
||||
@@ -671,7 +650,6 @@ void WavegenInit(int rate, int wavemult_fact)
|
||||
for (ix = 0; ix < N_EMBEDDED_VALUES; ix++)
|
||||
embedded_value[ix] = embedded_default[ix];
|
||||
|
||||
|
||||
// set up window to generate a spread of harmonics from a
|
||||
// single peak for HF peaks
|
||||
wavemult_max = (samplerate * wavemult_fact)/(256 * 50);
|
||||
@@ -695,7 +673,6 @@ void WavegenInit(int rate, int wavemult_fact)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int GetAmplitude(void)
|
||||
{
|
||||
int amp;
|
||||
@@ -708,7 +685,6 @@ int GetAmplitude(void)
|
||||
return general_amplitude;
|
||||
}
|
||||
|
||||
|
||||
static void WavegenSetEcho(void)
|
||||
{
|
||||
int delay;
|
||||
@@ -749,8 +725,6 @@ static void WavegenSetEcho(void)
|
||||
general_amplitude = ((general_amplitude * (500-amp))/500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
|
||||
{
|
||||
// Calculate the amplitude of each harmonics from the formants
|
||||
@@ -862,8 +836,6 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
|
||||
return hmax; // highest harmonic number
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void AdvanceParameters()
|
||||
{
|
||||
// Called every 64 samples to increment the formant freq, height, and widths
|
||||
@@ -926,7 +898,6 @@ static void AdvanceParameters()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef PLATFORM_RISCOS
|
||||
static double resonator(RESONATOR *r, double input)
|
||||
{
|
||||
@@ -939,8 +910,6 @@ static double resonator(RESONATOR *r, double input)
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void setresonator(RESONATOR *rp, int freq, int bwidth, int init)
|
||||
{
|
||||
// freq Frequency of resonator in Hz
|
||||
@@ -967,7 +936,6 @@ static void setresonator(RESONATOR *rp, int freq, int bwidth, int init)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InitBreath(void)
|
||||
{
|
||||
#ifndef PLATFORM_RISCOS
|
||||
@@ -981,8 +949,6 @@ void InitBreath(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetBreath()
|
||||
{
|
||||
#ifndef PLATFORM_RISCOS
|
||||
@@ -1001,7 +967,6 @@ static void SetBreath()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int ApplyBreath(void)
|
||||
{
|
||||
int value = 0;
|
||||
@@ -1023,8 +988,6 @@ static int ApplyBreath(void)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Wavegen()
|
||||
{
|
||||
unsigned short waveph;
|
||||
@@ -1248,7 +1211,6 @@ int Wavegen()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int PlaySilence(int length, int resume)
|
||||
{
|
||||
static int n_samples;
|
||||
@@ -1283,8 +1245,6 @@ static int PlaySilence(int length, int resume)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int PlayWave(int length, int resume, unsigned char *data, int scale, int amp)
|
||||
{
|
||||
static int n_samples;
|
||||
@@ -1338,7 +1298,6 @@ static int PlayWave(int length, int resume, unsigned char *data, int scale, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int SetWithRange0(int value, int max)
|
||||
{
|
||||
if (value < 0)
|
||||
@@ -1348,7 +1307,6 @@ static int SetWithRange0(int value, int max)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
static void SetPitchFormants()
|
||||
{
|
||||
int ix;
|
||||
@@ -1372,7 +1330,6 @@ static void SetPitchFormants()
|
||||
wvoice->height[1] = (wvoice->height2[1] * (256 - factor))/256;
|
||||
}
|
||||
|
||||
|
||||
void SetEmbedded(int control, int value)
|
||||
{
|
||||
// there was an embedded command in the text at this point
|
||||
@@ -1400,22 +1357,18 @@ void SetEmbedded(int control, int value)
|
||||
case EMBED_P:
|
||||
SetPitchFormants();
|
||||
break;
|
||||
|
||||
case EMBED_A: // amplitude
|
||||
general_amplitude = GetAmplitude();
|
||||
break;
|
||||
|
||||
case EMBED_F: // emphasis
|
||||
general_amplitude = GetAmplitude();
|
||||
break;
|
||||
|
||||
case EMBED_H:
|
||||
WavegenSetEcho();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WavegenSetVoice(voice_t *v)
|
||||
{
|
||||
static voice_t v2;
|
||||
@@ -1438,7 +1391,6 @@ void WavegenSetVoice(voice_t *v)
|
||||
MarkerEvent(espeakEVENT_SAMPLERATE, 0, wvoice->samplerate, 0, out_ptr);
|
||||
}
|
||||
|
||||
|
||||
static void SetAmplitude(int length, unsigned char *amp_env, int value)
|
||||
{
|
||||
amp_ix = 0;
|
||||
@@ -1453,7 +1405,6 @@ static void SetAmplitude(int length, unsigned char *amp_env, int value)
|
||||
amplitude_env = amp_env;
|
||||
}
|
||||
|
||||
|
||||
void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range)
|
||||
{
|
||||
int x;
|
||||
@@ -1483,7 +1434,6 @@ void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pit
|
||||
*pitch_range = base + (pitch2 * range)/2 - *pitch_base;
|
||||
}
|
||||
|
||||
|
||||
void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
|
||||
{
|
||||
// length in samples
|
||||
@@ -1502,13 +1452,8 @@ void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
|
||||
wdata.pitch = ((wdata.pitch_env[0] * wdata.pitch_range) >>8) + wdata.pitch_base; // Hz << 12
|
||||
|
||||
flutter_amp = wvoice->flutter;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v)
|
||||
{
|
||||
int ix;
|
||||
@@ -1594,7 +1539,6 @@ void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int Wavegen2(int length, int modulation, int resume, frame_t *fr1, frame_t *fr2)
|
||||
{
|
||||
if (resume == 0)
|
||||
@@ -1614,8 +1558,6 @@ void Write4Bytes(FILE *f, int value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int WavegenFill2(int fill_zeros)
|
||||
{
|
||||
// Pick up next wavegen commands from the queue
|
||||
@@ -1654,7 +1596,6 @@ int WavegenFill2(int fill_zeros)
|
||||
case WCMD_PITCH:
|
||||
SetPitch(length, (unsigned char *)q[2], q[3] >> 16, q[3] & 0xffff);
|
||||
break;
|
||||
|
||||
case WCMD_PAUSE:
|
||||
if (resume == 0)
|
||||
echo_complete -= length;
|
||||
@@ -1665,7 +1606,6 @@ int WavegenFill2(int fill_zeros)
|
||||
#endif
|
||||
result = PlaySilence(length, resume);
|
||||
break;
|
||||
|
||||
case WCMD_WAVE:
|
||||
echo_complete = echo_length;
|
||||
wdata.n_mix_wavefile = 0;
|
||||
@@ -1674,7 +1614,6 @@ int WavegenFill2(int fill_zeros)
|
||||
#endif
|
||||
result = PlayWave(length, resume, (unsigned char *)q[2], q[3] & 0xff, q[3] >> 8);
|
||||
break;
|
||||
|
||||
case WCMD_WAVE2:
|
||||
// wave file to be played at the same time as synthesis
|
||||
wdata.mix_wave_amp = q[3] >> 8;
|
||||
@@ -1689,14 +1628,12 @@ int WavegenFill2(int fill_zeros)
|
||||
wdata.mix_wavefile_offset = 0;
|
||||
wdata.mix_wavefile = (unsigned char *)q[2];
|
||||
break;
|
||||
|
||||
case WCMD_SPECT2: // as WCMD_SPECT but stop any concurrent wave file
|
||||
wdata.n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case
|
||||
case WCMD_SPECT:
|
||||
echo_complete = echo_length;
|
||||
result = Wavegen2(length & 0xffff, q[1] >> 16, resume, (frame_t *)q[2], (frame_t *)q[3]);
|
||||
break;
|
||||
|
||||
#ifdef INCLUDE_KLATT
|
||||
case WCMD_KLATT2: // as WCMD_SPECT but stop any concurrent wave file
|
||||
wdata.n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case
|
||||
@@ -1705,36 +1642,29 @@ int WavegenFill2(int fill_zeros)
|
||||
result = Wavegen_Klatt2(length & 0xffff, q[1] >> 16, resume, (frame_t *)q[2], (frame_t *)q[3]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case WCMD_MARKER:
|
||||
marker_type = q[0] >> 8;
|
||||
MarkerEvent(marker_type, q[1], q[2], q[3], out_ptr);
|
||||
if (marker_type == 1) // word marker
|
||||
current_source_index = q[1] & 0xffffff;
|
||||
break;
|
||||
|
||||
case WCMD_AMPLITUDE:
|
||||
SetAmplitude(length, (unsigned char *)q[2], q[3]);
|
||||
break;
|
||||
|
||||
case WCMD_VOICE:
|
||||
WavegenSetVoice((voice_t *)q[2]);
|
||||
free((voice_t *)q[2]);
|
||||
break;
|
||||
|
||||
case WCMD_EMBEDDED:
|
||||
SetEmbedded(q[1], q[2]);
|
||||
break;
|
||||
|
||||
case WCMD_MBROLA_DATA:
|
||||
result = MbrolaFill(length, resume, (general_amplitude * wvoice->voicing)/64);
|
||||
break;
|
||||
|
||||
case WCMD_FMT_AMPLITUDE:
|
||||
if ((wdata.amplitude_fmt = q[1]) == 0)
|
||||
wdata.amplitude_fmt = 100; // percentage, but value=0 means 100%
|
||||
break;
|
||||
|
||||
#if HAVE_SONIC_H
|
||||
case WCMD_SONIC_SPEED:
|
||||
sonicSpeed = (double)q[1] / 1024;
|
||||
@@ -1752,7 +1682,6 @@ int WavegenFill2(int fill_zeros)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_SONIC_H
|
||||
/* Speed up the audio samples with libsonic. */
|
||||
static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text)
|
||||
@@ -1775,7 +1704,6 @@ static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Call WavegenFill2, and then speed up the output samples. */
|
||||
int WavegenFill(int fill_zeros)
|
||||
{
|
||||
|
||||
@@ -52,8 +52,6 @@
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
|
||||
extern void Write4Bytes(FILE *f, int value);
|
||||
char path_home[N_PATH_HOME]; // this is the espeak-data directory
|
||||
|
||||
@@ -123,13 +121,10 @@ static const char *help_text =
|
||||
"\t List the available voices for the specified language.\n"
|
||||
"\t If <language> is omitted, then list all voices.\n";
|
||||
|
||||
|
||||
void DisplayVoices(FILE *f_out, char *language);
|
||||
|
||||
USHORT voice_pcnt[N_PEAKS+1][3];
|
||||
|
||||
|
||||
|
||||
void DisplayVoices(FILE *f_out, char *language)
|
||||
{
|
||||
int ix;
|
||||
@@ -190,7 +185,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int OpenWaveFile(const char *path, int rate)
|
||||
{
|
||||
// Set the length of 0x7ffff000 for --stdout
|
||||
@@ -228,9 +222,6 @@ static int OpenWaveFile(const char *path, int rate)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void CloseWaveFile()
|
||||
{
|
||||
unsigned int pos;
|
||||
@@ -250,12 +241,8 @@ static void CloseWaveFile()
|
||||
|
||||
fclose(f_wave);
|
||||
f_wave = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int WavegenFile(void)
|
||||
{
|
||||
int finished;
|
||||
@@ -291,11 +278,8 @@ static int WavegenFile(void)
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void init_path(char *argv0, char *path_specified)
|
||||
{
|
||||
|
||||
if (path_specified) {
|
||||
sprintf(path_home, "%s/espeak-data", path_specified);
|
||||
return;
|
||||
@@ -348,7 +332,6 @@ static void init_path(char *argv0, char *path_specified)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int initialise(void)
|
||||
{
|
||||
int param;
|
||||
@@ -367,7 +350,6 @@ static int initialise(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if ((result = LoadPhData(&srate)) != 1) {
|
||||
if (result == -1) {
|
||||
fprintf(stderr, "Failed to load espeak-data\n");
|
||||
@@ -386,8 +368,6 @@ static int initialise(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NEED_GETOPT
|
||||
struct option {
|
||||
char *name;
|
||||
@@ -525,88 +505,69 @@ int main(int argc, char **argv)
|
||||
if ((sscanf(optarg2, "%d", &value) == 1) && (value <= 4))
|
||||
option_multibyte = value;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
init_path(argv[0], data_path);
|
||||
printf("\nspeak text-to-speech: %s Data at: %s\n%s", version_string, path_home, help_text);
|
||||
exit(0);
|
||||
|
||||
case 'k':
|
||||
option_capitals = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
phoneme_options |= espeakPHONEMES_SHOW;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
phoneme_options |= espeakPHONEMES_TRACE;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
option_ssml = 1;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
pitch_adjustment = atoi(optarg2);
|
||||
if (pitch_adjustment > 99) pitch_adjustment = 99;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
strncpy0(filename, optarg2, sizeof(filename));
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
value = 0;
|
||||
value = atoi(optarg2);
|
||||
option_linelength = value;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
amp = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
speed = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
wordgap = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
strncpy0(voicename, optarg2, sizeof(voicename));
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
option_waveout = 1;
|
||||
strncpy0(wavefile, optarg2, sizeof(wavefile));
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
option_endpause = 0;
|
||||
break;
|
||||
|
||||
case 0x100: // --stdin
|
||||
flag_stdin = 1;
|
||||
break;
|
||||
|
||||
case 0x105: // --stdout
|
||||
option_waveout = 1;
|
||||
strcpy(wavefile, "stdout");
|
||||
break;
|
||||
|
||||
case 0x101: // --compile-debug
|
||||
case 0x102: // --compile
|
||||
if (optarg2 != NULL)
|
||||
strncpy0(voicename, optarg2, sizeof(voicename));
|
||||
flag_compile = c;
|
||||
break;
|
||||
|
||||
case 0x103: // --punct
|
||||
option_punctuation = 1;
|
||||
if (optarg2 != NULL) {
|
||||
@@ -616,34 +577,28 @@ int main(int argc, char **argv)
|
||||
option_punctuation = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x104: // --voices
|
||||
init_path(argv[0], data_path);
|
||||
DisplayVoices(stdout, optarg2);
|
||||
exit(0);
|
||||
|
||||
case 0x106: // -- split
|
||||
if (optarg2 == NULL)
|
||||
samples_split = 30; // default 30 minutes
|
||||
else
|
||||
samples_split = atoi(optarg2);
|
||||
break;
|
||||
|
||||
case 0x107: // --path
|
||||
data_path = optarg2;
|
||||
break;
|
||||
|
||||
case 0x108: // --phonout
|
||||
if ((f_trans = fopen(optarg2, "w")) == NULL) {
|
||||
fprintf(stderr, "Can't write to: %s\n", optarg2);
|
||||
f_trans = stderr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x109: // --pho
|
||||
phoneme_options |= espeakPHONEMES_MBROLA;
|
||||
break;
|
||||
|
||||
case 0x10a: // --ipa
|
||||
phoneme_options |= espeakPHONEMES_IPA;
|
||||
if (optarg2 != NULL) {
|
||||
@@ -662,15 +617,12 @@ int main(int argc, char **argv)
|
||||
phoneme_options |= espeakPHONEMES_TIE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x10b: // --version
|
||||
init_path(argv[0], data_path);
|
||||
printf("speak text-to-speech: %s Data at: %s\n", version_string, path_home);
|
||||
exit(0);
|
||||
|
||||
case 0x10c: // --sep
|
||||
phoneme_options |= espeakPHONEMES_SHOW;
|
||||
if (optarg2 == 0)
|
||||
@@ -680,7 +632,6 @@ int main(int argc, char **argv)
|
||||
if (phonemes_separator == 'z')
|
||||
phonemes_separator = 0x200c; // ZWNJ
|
||||
break;
|
||||
|
||||
case 0x10d: // --tie
|
||||
phoneme_options |= (espeakPHONEMES_SHOW | espeakPHONEMES_TIE);
|
||||
if (optarg2 == 0)
|
||||
@@ -690,7 +641,6 @@ int main(int argc, char **argv)
|
||||
if (phonemes_separator == 'z')
|
||||
phonemes_separator = 0x200d; // ZWJ
|
||||
break;
|
||||
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
@@ -732,7 +682,6 @@ int main(int argc, char **argv)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
SetParameter(espeakRATE, speed, 0);
|
||||
SetParameter(espeakVOLUME, amp, 0);
|
||||
SetParameter(espeakCAPITALS, option_capitals, 0);
|
||||
|
||||
Reference in New Issue
Block a user