code cleanup: change global int current_phoneme table to static

It's only used in SpeakNextClause() and related to SelectPhonemeTable().

Another solution void be to keep SelectPhonemeTable() as a void function
and do a current_phoneme_table = voice->phoneme_tab_ix after the call to
SelectPhonemeTable().
This commit is contained in:
Juho Hiltunen
2020-07-21 12:39:51 +03:00
parent 992745508e
commit c0ff3696b9
4 changed files with 5 additions and 6 deletions
-1
View File
@@ -249,7 +249,6 @@ phoneme_add_feature(PHONEME_TAB *phoneme,
// Several phoneme tables may be loaded into memory. phoneme_tab points to
// one for the current voice
extern int n_phoneme_tab;
extern int current_phoneme_table;
extern PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
extern unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited
+2 -3
View File
@@ -45,7 +45,6 @@ const int version_phdata = 0x014801;
// copy the current phoneme table into here
int n_phoneme_tab;
int current_phoneme_table;
PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited
@@ -359,12 +358,12 @@ static void SetUpPhonemeTable(int number, bool recursing)
}
}
void SelectPhonemeTable(int number)
int SelectPhonemeTable(int number)
{
n_phoneme_tab = 0;
SetUpPhonemeTable(number, false); // recursively for included phoneme tables
n_phoneme_tab++;
current_phoneme_table = number;
return number;
}
int LookupPhonemeTable(const char *name)
+1 -1
View File
@@ -52,7 +52,7 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph,
int NumInstnWords(unsigned short *prog);
int PhonemeCode(unsigned int mnem);
void SelectPhonemeTable(int number);
int SelectPhonemeTable(int number);
int SelectPhonemeTableName(const char *name);
#ifdef __cplusplus
+2 -1
View File
@@ -1549,6 +1549,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume)
return 0; // finished the phoneme list
}
static int current_phoneme_table;
int SpeakNextClause(int control)
{
// Speak text from memory (text_in)
@@ -1577,7 +1578,7 @@ int SpeakNextClause(int control)
}
if (current_phoneme_table != voice->phoneme_tab_ix)
SelectPhonemeTable(voice->phoneme_tab_ix);
current_phoneme_table = SelectPhonemeTable(voice->phoneme_tab_ix);
// read the next clause from the input text file, translate it, and generate
// entries in the wavegen command queue