mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-04 07:48:47 +00:00
Revert "maintainability: pass n_ph_list2 and ph_list2 to MakePhonemeList() and SubstitutePhonemes() instead of using globals"
This reverts commit f0c345eb6a.
Fixes #824.
This commit is contained in:
committed by
Valdis Vitolins
parent
30214437fc
commit
5f1a4f9cbd
@@ -43,7 +43,10 @@ const unsigned char pause_phonemes[8] = {
|
|||||||
0, phonPAUSE_VSHORT, phonPAUSE_SHORT, phonPAUSE, phonPAUSE_LONG, phonGLOTTALSTOP, phonPAUSE_LONG, phonPAUSE_LONG
|
0, phonPAUSE_VSHORT, phonPAUSE_SHORT, phonPAUSE, phonPAUSE_LONG, phonGLOTTALSTOP, phonPAUSE_LONG, phonPAUSE_LONG
|
||||||
};
|
};
|
||||||
|
|
||||||
static int SubstitutePhonemes(PHONEME_LIST *plist_out, int n_ph_list2, PHONEME_LIST2 *ph_list2)
|
extern int n_ph_list2;
|
||||||
|
extern PHONEME_LIST2 ph_list2[N_PHONEME_LIST]; // first stage of text->phonemes
|
||||||
|
|
||||||
|
static int SubstitutePhonemes(PHONEME_LIST *plist_out)
|
||||||
{
|
{
|
||||||
// Copy the phonemes list and perform any substitutions that are required for the
|
// Copy the phonemes list and perform any substitutions that are required for the
|
||||||
// current voice
|
// current voice
|
||||||
@@ -109,7 +112,7 @@ static int SubstitutePhonemes(PHONEME_LIST *plist_out, int n_ph_list2, PHONEME_L
|
|||||||
return n_plist_out;
|
return n_plist_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n_ph_list2, PHONEME_LIST2 *ph_list2)
|
void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence)
|
||||||
{
|
{
|
||||||
int ix = 0;
|
int ix = 0;
|
||||||
int j;
|
int j;
|
||||||
@@ -143,11 +146,11 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n
|
|||||||
memset(&worddata, 0, sizeof(worddata));
|
memset(&worddata, 0, sizeof(worddata));
|
||||||
plist2 = ph_list2;
|
plist2 = ph_list2;
|
||||||
phlist = phoneme_list;
|
phlist = phoneme_list;
|
||||||
end_sourceix = plist2[*n_ph_list2 - 1].sourceix;
|
end_sourceix = plist2[n_ph_list2-1].sourceix;
|
||||||
|
|
||||||
// is the last word of the clause unstressed ?
|
// is the last word of the clause unstressed ?
|
||||||
max_stress = 0;
|
max_stress = 0;
|
||||||
for (j = *n_ph_list2 - 3; j >= 0; j--) {
|
for (j = n_ph_list2-3; j >= 0; j--) {
|
||||||
// start with the last phoneme (before the terminating pauses) and move backwards
|
// start with the last phoneme (before the terminating pauses) and move backwards
|
||||||
if ((plist2[j].stresslevel & 0x7f) > max_stress)
|
if ((plist2[j].stresslevel & 0x7f) > max_stress)
|
||||||
max_stress = plist2[j].stresslevel & 0x7f;
|
max_stress = plist2[j].stresslevel & 0x7f;
|
||||||
@@ -172,7 +175,7 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n
|
|||||||
delete_count = 0;
|
delete_count = 0;
|
||||||
current_phoneme_tab = tr->phoneme_tab_ix;
|
current_phoneme_tab = tr->phoneme_tab_ix;
|
||||||
int deleted_sourceix = -1;
|
int deleted_sourceix = -1;
|
||||||
for (j = 0; j < *n_ph_list2; j++) {
|
for (j = 0; j < n_ph_list2; j++) {
|
||||||
if (current_phoneme_tab != tr->phoneme_tab_ix)
|
if (current_phoneme_tab != tr->phoneme_tab_ix)
|
||||||
plist2[j].synthflags |= SFLAG_SWITCHED_LANG;
|
plist2[j].synthflags |= SFLAG_SWITCHED_LANG;
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*n_ph_list2 -= delete_count;
|
n_ph_list2 -= delete_count;
|
||||||
|
|
||||||
if ((regression = tr->langopts.param[LOPT_REGRESSIVE_VOICING]) != 0) {
|
if ((regression = tr->langopts.param[LOPT_REGRESSIVE_VOICING]) != 0) {
|
||||||
// set consonant clusters to all voiced or all unvoiced
|
// set consonant clusters to all voiced or all unvoiced
|
||||||
@@ -209,7 +212,7 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n
|
|||||||
bool stop_propagation = false;
|
bool stop_propagation = false;
|
||||||
voicing = 0;
|
voicing = 0;
|
||||||
|
|
||||||
for (j = *n_ph_list2 - 1; j >= 0; j--) {
|
for (j = n_ph_list2-1; j >= 0; j--) {
|
||||||
ph = phoneme_tab[plist2[j].phcode];
|
ph = phoneme_tab[plist2[j].phcode];
|
||||||
if (ph == NULL)
|
if (ph == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -270,7 +273,7 @@ void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence, int *n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n_ph_list3 = SubstitutePhonemes(ph_list3, (int) *n_ph_list2, ph_list2) - 2;
|
n_ph_list3 = SubstitutePhonemes(ph_list3) - 2;
|
||||||
|
|
||||||
for (j = 0; (j < n_ph_list3) && (ix < N_PHONEME_LIST-3);) {
|
for (j = 0; (j < n_ph_list3) && (ix < N_PHONEME_LIST-3);) {
|
||||||
if (ph_list3[j].sourceix) {
|
if (ph_list3[j].sourceix) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#ifndef ESPEAK_NG_PHONEMELIST_H
|
#ifndef ESPEAK_NG_PHONEMELIST_H
|
||||||
#define ESPEAK_NG_PHONEMELIST_H
|
#define ESPEAK_NG_PHONEMELIST_H
|
||||||
|
|
||||||
#include "synthesize.h"
|
|
||||||
#include "translate.h"
|
#include "translate.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -33,11 +32,7 @@ extern "C"
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MakePhonemeList(Translator *tr,
|
void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence);
|
||||||
int post_pause,
|
|
||||||
bool start_sentence,
|
|
||||||
int *n_ph_list2,
|
|
||||||
PHONEME_LIST2 *ph_list2);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2719,7 +2719,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
|||||||
if (Eof() && ((word_count == 0) || (option_endpause == 0)))
|
if (Eof() && ((word_count == 0) || (option_endpause == 0)))
|
||||||
clause_pause = 10;
|
clause_pause = 10;
|
||||||
|
|
||||||
MakePhonemeList(tr, clause_pause, new_sentence2, &n_ph_list2, ph_list2);
|
MakePhonemeList(tr, clause_pause, new_sentence2);
|
||||||
phoneme_list[N_PHONEME_LIST].ph = NULL; // recognize end of phoneme_list array, in Generate()
|
phoneme_list[N_PHONEME_LIST].ph = NULL; // recognize end of phoneme_list array, in Generate()
|
||||||
phoneme_list[N_PHONEME_LIST].sourceix = 1;
|
phoneme_list[N_PHONEME_LIST].sourceix = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user