Browse Source

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().
master
Juho Hiltunen 4 years ago
parent
commit
c0ff3696b9

+ 0
- 1
src/libespeak-ng/phoneme.h View File

// Several phoneme tables may be loaded into memory. phoneme_tab points to // Several phoneme tables may be loaded into memory. phoneme_tab points to
// one for the current voice // one for the current voice
extern int n_phoneme_tab; extern int n_phoneme_tab;
extern int current_phoneme_table;
extern PHONEME_TAB *phoneme_tab[N_PHONEME_TAB]; extern PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
extern unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited extern unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited



+ 2
- 3
src/libespeak-ng/synthdata.c View File



// copy the current phoneme table into here // copy the current phoneme table into here
int n_phoneme_tab; int n_phoneme_tab;
int current_phoneme_table;
PHONEME_TAB *phoneme_tab[N_PHONEME_TAB]; PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited


} }
} }


void SelectPhonemeTable(int number)
int SelectPhonemeTable(int number)
{ {
n_phoneme_tab = 0; n_phoneme_tab = 0;
SetUpPhonemeTable(number, false); // recursively for included phoneme tables SetUpPhonemeTable(number, false); // recursively for included phoneme tables
n_phoneme_tab++; n_phoneme_tab++;
current_phoneme_table = number;
return number;
} }


int LookupPhonemeTable(const char *name) int LookupPhonemeTable(const char *name)

+ 1
- 1
src/libespeak-ng/synthdata.h View File



int NumInstnWords(unsigned short *prog); int NumInstnWords(unsigned short *prog);
int PhonemeCode(unsigned int mnem); int PhonemeCode(unsigned int mnem);
void SelectPhonemeTable(int number);
int SelectPhonemeTable(int number);
int SelectPhonemeTableName(const char *name); int SelectPhonemeTableName(const char *name);


#ifdef __cplusplus #ifdef __cplusplus

+ 2
- 1
src/libespeak-ng/synthesize.c View File

return 0; // finished the phoneme list return 0; // finished the phoneme list
} }


static int current_phoneme_table;
int SpeakNextClause(int control) int SpeakNextClause(int control)
{ {
// Speak text from memory (text_in) // Speak text from memory (text_in)
} }


if (current_phoneme_table != voice->phoneme_tab_ix) 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 // read the next clause from the input text file, translate it, and generate
// entries in the wavegen command queue // entries in the wavegen command queue

Loading…
Cancel
Save