Browse Source

code cleanup: remove unnecessary current_voice_id in readclause.c

Instead of passing a temporary variable current_voice_id to SSML
processing logic and then copying the value to voice_change, pass
voice_change directly. GetVoiceAttributes() both sets voice_change and
retuns CLAUSE_TYPE_VOICE_CHANGE that is used by TranslateClause() for
error checking.

tests/ssml/language-switch.ssml covers the intended behavior of language
switching and will fail when either voice_change or CLAUSE_TYPE_VOICE_CHANGE
is not set correctly.
master
Juho Hiltunen 4 years ago
parent
commit
19e2f697f6
2 changed files with 2 additions and 10 deletions
  1. 1
    9
      src/libespeak-ng/readclause.c
  2. 1
    1
      src/libespeak-ng/ssml.c

+ 1
- 9
src/libespeak-ng/readclause.c View File



static espeak_VOICE base_voice; static espeak_VOICE base_voice;
static char base_voice_variant_name[40] = { 0 }; static char base_voice_variant_name[40] = { 0 };
static char current_voice_id[40] = { 0 };


static int n_param_stack; static int n_param_stack;
PARAM_STACK param_stack[N_PARAM_STACK]; PARAM_STACK param_stack[N_PARAM_STACK];
tr->clause_upper_count = 0; tr->clause_upper_count = 0;
tr->clause_lower_count = 0; tr->clause_lower_count = 0;
*tone_type = 0; *tone_type = 0;
*voice_change = 0;


if (ungot_char2 != 0) if (ungot_char2 != 0)
c2 = ungot_char2; c2 = ungot_char2;
xml_buf[n_xml_buf] = 0; xml_buf[n_xml_buf] = 0;
c2 = ' '; c2 = ' ';


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);
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);


if (terminator != 0) { if (terminator != 0) {
buf[ix] = ' '; buf[ix] = ' ';
buf[ix++] = 0; buf[ix++] = 0;

if (terminator & CLAUSE_TYPE_VOICE_CHANGE)
strcpy(voice_change, current_voice_id);
return terminator; return terminator;
} }
c1 = ' '; c1 = ' ';


option_punctuation = speech_parameters[espeakPUNCTUATION]; option_punctuation = speech_parameters[espeakPUNCTUATION];
option_capitals = speech_parameters[espeakCAPITALS]; option_capitals = speech_parameters[espeakCAPITALS];

current_voice_id[0] = 0;

ignore_text = false; ignore_text = false;
audio_text = false; audio_text = false;
clear_skipping_text = false; clear_skipping_text = false;

+ 1
- 1
src/libespeak-ng/ssml.c View File

// a voice change. // a voice change.
// If it's a closing tag, delete the top frame of the stack and determine whether this implies // If it's a closing tag, delete the top frame of the stack and determine whether this implies
// a voice change. // a voice change.
// Returns CLAUSE_TYPE_VOICE_CHANGE if there is a voice change
// if there is a voice change, sets current_voice_id and returns CLAUSE_TYPE_VOICE_CHANGE


wchar_t *lang; wchar_t *lang;
wchar_t *gender; wchar_t *gender;

Loading…
Cancel
Save