Skip to content

Commit 4d0a4df

Browse files
committed
Revert "code cleanup: remove unnecessary current_voice_id in readclause.c"
See #950.
1 parent 16f30f6 commit 4d0a4df

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/libespeak-ng/readclause.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static SSML_STACK ssml_stack[N_SSML_STACK];
7373

7474
static espeak_VOICE base_voice;
7575
static char base_voice_variant_name[40] = { 0 };
76+
static char current_voice_id[40] = { 0 };
7677

7778
static int n_param_stack;
7879
PARAM_STACK param_stack[N_PARAM_STACK];
@@ -509,6 +510,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
509510
tr->clause_upper_count = 0;
510511
tr->clause_lower_count = 0;
511512
*tone_type = 0;
513+
*voice_change = 0;
512514

513515
if (ungot_char2 != 0) {
514516
c2 = ungot_char2;
@@ -606,11 +608,14 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
606608
xml_buf[n_xml_buf] = 0;
607609
c2 = ' ';
608610

609-
terminator = ProcessSsmlTag(xml_buf, buf, &ix, n_buf, xmlbase, &audio_text, voice_change, &base_voice, base_voice_variant_name, &ignore_text, &clear_skipping_text, &sayas_mode, &sayas_start, ssml_stack, &n_ssml_stack, &n_param_stack, (int *)speech_parameters);
611+
terminator = ProcessSsmlTag(xml_buf, buf, &ix, n_buf, xmlbase, &audio_text, current_voice_id, &base_voice, base_voice_variant_name, &ignore_text, &clear_skipping_text, &sayas_mode, &sayas_start, ssml_stack, &n_ssml_stack, &n_param_stack, (int *)speech_parameters);
610612

611613
if (terminator != 0) {
612614
buf[ix] = ' ';
613615
buf[ix++] = 0;
616+
617+
if (terminator & CLAUSE_TYPE_VOICE_CHANGE)
618+
strcpy(voice_change, current_voice_id);
614619
return terminator;
615620
}
616621
c1 = ' ';
@@ -1000,6 +1005,9 @@ void InitText2(void)
10001005

10011006
option_punctuation = speech_parameters[espeakPUNCTUATION];
10021007
option_capitals = speech_parameters[espeakCAPITALS];
1008+
1009+
current_voice_id[0] = 0;
1010+
10031011
ignore_text = false;
10041012
audio_text = false;
10051013
clear_skipping_text = false;

‎src/libespeak-ng/ssml.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type, SSML_STACK *ssml_sp, SS
313313
// a voice change.
314314
// If it's a closing tag, delete the top frame of the stack and determine whether this implies
315315
// a voice change.
316-
// if there is a voice change, sets current_voice_id and returns CLAUSE_TYPE_VOICE_CHANGE
316+
// Returns CLAUSE_TYPE_VOICE_CHANGE if there is a voice change
317317

318318
wchar_t *lang;
319319
wchar_t *gender;

0 commit comments

Comments
 (0)