summaryrefslogtreecommitdiffstats
path: root/pico
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2009-07-09 17:17:18 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2009-07-09 17:20:02 -0700
commit5da148ef02f1ed01db73163c2befde420b875a9f (patch)
tree718db83deb45806c55102dee6664f6072218be78 /pico
parent744a0e6d86f037a9f815adbcbb2dc5f410aa5007 (diff)
downloadexternal_svox-5da148ef02f1ed01db73163c2befde420b875a9f.zip
external_svox-5da148ef02f1ed01db73163c2befde420b875a9f.tar.gz
external_svox-5da148ef02f1ed01db73163c2befde420b875a9f.tar.bz2
Fix bug where Pico TTS engine doesn't synthesize anything if there
is no language specified in the <speak> tag. Using currently loaded language in that case, or the first lang is none was previously loaded.
Diffstat (limited to 'pico')
-rw-r--r--pico/tts/com_svox_picottsengine.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/pico/tts/com_svox_picottsengine.cpp b/pico/tts/com_svox_picottsengine.cpp
index 1649d11..186d8bf 100644
--- a/pico/tts/com_svox_picottsengine.cpp
+++ b/pico/tts/com_svox_picottsengine.cpp
@@ -126,7 +126,7 @@ static int checkForLocale( const char * locale )
int found = -1; /* language not found */
int i;
if (locale == NULL) {
- LOGE("checkForLanguage called with NULL language");
+ LOGE("checkForLocale called with NULL language");
return found;
}
@@ -400,6 +400,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Set the current locale/voice. */
strcpy( picoProp_currLang, picoSupportedLang[langIndex] );
+ picoCurrentLangIndex = langIndex;
LOGI("loaded %s successfully", picoProp_currLang);
return TTS_SUCCESS;
}
@@ -1228,10 +1229,23 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
return TTS_FAILURE;
}
char * lang = parser->getParsedDocumentLanguage();
- if (doLanguageSwitch(lang) == TTS_FAILURE) {
- LOGE("Failed to switch to language specified in SSML document.");
- delete parser;
- return TTS_FAILURE;
+ if (lang != NULL) {
+ if (doLanguageSwitch(lang) == TTS_FAILURE) {
+ LOGE("Failed to switch to language (%s) specified in SSML document.", lang);
+ delete parser;
+ return TTS_FAILURE;
+ }
+ } else {
+ // lang is NULL, pick a language so the synthesis can be performed
+ if (picoCurrentLangIndex == -1) {
+ // no current language loaded, pick the first one and load it
+ if (doLanguageSwitchFromLangIndex(0) == TTS_FAILURE) {
+ LOGE("Failed to switch to default language.");
+ delete parser;
+ return TTS_FAILURE;
+ }
+ }
+ LOGE("No language in SSML, using current language (%s).", picoProp_currLang);
}
delete parser;
} else {