summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpico/Android.mk1
-rwxr-xr-xpico/compat/jni/Android.mk3
-rw-r--r--pico/compat/jni/com_android_tts_compat_SynthProxy.cpp16
-rwxr-xr-xpico/compat/src/com/android/tts/compat/CompatTtsService.java5
-rw-r--r--pico/tts/com_svox_picottsengine.cpp104
-rwxr-xr-xpico/tts/svox_ssml_parser.cpp114
6 files changed, 124 insertions, 119 deletions
diff --git a/pico/Android.mk b/pico/Android.mk
index 6203ba9..444cbdf 100755
--- a/pico/Android.mk
+++ b/pico/Android.mk
@@ -125,6 +125,7 @@ LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
libnativehelper \
libmedia \
+ libmedia_native \
libutils \
libcutils \
libdl
diff --git a/pico/compat/jni/Android.mk b/pico/compat/jni/Android.mk
index 900723e..a06d620 100755
--- a/pico/compat/jni/Android.mk
+++ b/pico/compat/jni/Android.mk
@@ -5,7 +5,7 @@ LOCAL_MODULE:= libttscompat
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
- android_tts_SynthProxy.cpp
+ com_android_tts_compat_SynthProxy.cpp
LOCAL_C_INCLUDES += \
frameworks/base/native/include \
@@ -15,6 +15,7 @@ LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
libnativehelper \
libmedia \
+ libmedia_native \
libutils \
libcutils
diff --git a/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp b/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp
index 01cceb0..27d79b7 100644
--- a/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp
+++ b/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp
@@ -158,7 +158,7 @@ class SynthProxyJniStorage {
}
if (mEngineLibHandle) {
int res = dlclose(mEngineLibHandle);
- LOGE_IF( res != 0, "~SynthProxyJniStorage(): dlclose returned %d", res);
+ ALOGE_IF( res != 0, "~SynthProxyJniStorage(): dlclose returned %d", res);
}
delete[] mBuffer;
}
@@ -208,7 +208,7 @@ static int callRequestStart(JNIEnv *env, jobject request,
encoding = AUDIO_FORMAT_ENCODING_PCM_16_BIT;
break;
default:
- LOGE("Can't play, bad format");
+ ALOGE("Can't play, bad format");
return ANDROID_TTS_FAILURE;
}
@@ -225,7 +225,7 @@ static int callRequestAudioAvailable(JNIEnv *env, jobject request, int8_t *buffe
// TODO: Not nice to have to copy the buffer. Use ByteBuffer?
jbyteArray javaBuffer = env->NewByteArray(length);
if (javaBuffer == NULL) {
- LOGE("Failed to allocate byte array");
+ ALOGE("Failed to allocate byte array");
return ANDROID_TTS_FAILURE;
}
@@ -263,7 +263,7 @@ __ttsSynthDoneCB(void **pUserdata, uint32_t rate,
android_tts_synth_status_t status)
{
if (*pUserdata == NULL){
- LOGE("userdata == NULL");
+ ALOGE("userdata == NULL");
return ANDROID_TTS_CALLBACK_HALT;
}
@@ -322,7 +322,7 @@ com_android_tts_compat_SynthProxy_setLowShelf(JNIEnv *env, jobject thiz, jboolea
if (fFilterShelfSlope != 0.0f) {
initializeEQ();
} else {
- LOGE("Invalid slope, can't be null");
+ ALOGE("Invalid slope, can't be null");
return ANDROID_TTS_FAILURE;
}
}
@@ -344,7 +344,7 @@ com_android_tts_compat_SynthProxy_native_setup(JNIEnv *env, jobject thiz,
void *engine_lib_handle = dlopen(nativeSoLibNativeString,
RTLD_NOW | RTLD_LOCAL);
if (engine_lib_handle == NULL) {
- LOGE("com_android_tts_compat_SynthProxy_native_setup(): engine_lib_handle == NULL");
+ ALOGE("com_android_tts_compat_SynthProxy_native_setup(): engine_lib_handle == NULL");
} else {
android_tts_entrypoint get_TtsEngine =
reinterpret_cast<android_tts_entrypoint>(dlsym(engine_lib_handle, "android_getTtsEngine"));
@@ -376,7 +376,7 @@ com_android_tts_compat_SynthProxy_native_setup(JNIEnv *env, jobject thiz,
static SynthProxyJniStorage *getSynthData(jint jniData)
{
if (jniData == 0) {
- LOGE("Engine not initialized");
+ ALOGE("Engine not initialized");
return NULL;
}
return reinterpret_cast<SynthProxyJniStorage *>(jniData);
@@ -672,7 +672,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
JNIEnv* env = NULL;
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- LOGE("ERROR: GetEnv failed\n");
+ ALOGE("ERROR: GetEnv failed\n");
return -1;
}
assert(env != NULL);
diff --git a/pico/compat/src/com/android/tts/compat/CompatTtsService.java b/pico/compat/src/com/android/tts/compat/CompatTtsService.java
index af65ba4..475afaf 100755
--- a/pico/compat/src/com/android/tts/compat/CompatTtsService.java
+++ b/pico/compat/src/com/android/tts/compat/CompatTtsService.java
@@ -101,7 +101,10 @@ public abstract class CompatTtsService extends TextToSpeechService {
protected int onLoadLanguage(String lang, String country, String variant) {
if (DBG) Log.d(TAG, "onLoadLanguage(" + lang + "," + country + "," + variant + ")");
int result = onIsLanguageAvailable(lang, country, variant);
- // TODO: actually load language
+ if (result >= TextToSpeech.LANG_AVAILABLE) {
+ mNativeSynth.setLanguage(lang, country, variant);
+ }
+
return result;
}
diff --git a/pico/tts/com_svox_picottsengine.cpp b/pico/tts/com_svox_picottsengine.cpp
index 2370964..b44f2bd 100644
--- a/pico/tts/com_svox_picottsengine.cpp
+++ b/pico/tts/com_svox_picottsengine.cpp
@@ -132,7 +132,7 @@ static int checkForLocale( const char * locale )
int found = -1; /* language not found */
int i;
if (locale == NULL) {
- LOGE("checkForLocale called with NULL language");
+ ALOGE("checkForLocale called with NULL language");
return found;
}
@@ -165,7 +165,7 @@ static int checkForLocale( const char * locale )
}
if (found < 0) {
- LOGE("TtsEngine::set language called with unsupported locale %s", locale);
+ ALOGE("TtsEngine::set language called with unsupported locale %s", locale);
}
};
return found;
@@ -313,7 +313,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
if (langIndex>=0) {
/* If we already have a loaded locale, check whether it is the same one as requested. */
if (picoProp_currLang && (strcmp(picoProp_currLang, picoSupportedLang[langIndex]) == 0)) {
- //LOGI("Language already loaded (%s == %s)", picoProp_currLang,
+ //ALOGI("Language already loaded (%s == %s)", picoProp_currLang,
// picoSupportedLang[langIndex]);
return TTS_SUCCESS;
}
@@ -329,7 +329,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/*re-init system object*/
ret = pico_initialize( picoMemArea, PICO_MEM_SIZE, &picoSystem );
if (PICO_OK != ret) {
- LOGE("Failed to initialize the pico system object\n");
+ ALOGE("Failed to initialize the pico system object\n");
return TTS_FAILURE;
}
}
@@ -347,7 +347,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
(picoUtppFileName==NULL) || (picoTaResourceName==NULL) || (picoSgResourceName==NULL) ||
(picoUtppResourceName==NULL)
) {
- LOGE("Failed to allocate memory for internal strings\n");
+ ALOGE("Failed to allocate memory for internal strings\n");
cleanResources();
return TTS_FAILURE;
}
@@ -385,7 +385,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Load the text analysis Lingware resource file. */
ret = pico_loadResource( picoSystem, picoTaFileName, &picoTaResource );
if (PICO_OK != ret) {
- LOGE("Failed to load textana resource for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to load textana resource for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -394,7 +394,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Load the signal generation Lingware resource file. */
ret = pico_loadResource( picoSystem, picoSgFileName, &picoSgResource );
if (PICO_OK != ret) {
- LOGE("Failed to load siggen resource for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to load siggen resource for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -405,7 +405,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
If this file is not present the loading will still succeed. */
ret = pico_loadResource( picoSystem, picoUtppFileName, &picoUtppResource );
if ((PICO_OK != ret) && (ret != PICO_EXC_CANT_OPEN_FILE)) {
- LOGE("Failed to load utpp resource for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to load utpp resource for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -414,7 +414,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Get the text analysis resource name. */
ret = pico_getResourceName( picoSystem, picoTaResource, (char *) picoTaResourceName );
if (PICO_OK != ret) {
- LOGE("Failed to get textana resource name for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to get textana resource name for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -426,14 +426,14 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Get utpp resource name - optional: see note above. */
ret = pico_getResourceName( picoSystem, picoUtppResource, (char *) picoUtppResourceName );
if (PICO_OK != ret) {
- LOGE("Failed to get utpp resource name for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to get utpp resource name for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
}
}
if (PICO_OK != ret) {
- LOGE("Failed to get siggen resource name for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to get siggen resource name for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -442,7 +442,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Create a voice definition. */
ret = pico_createVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME );
if (PICO_OK != ret) {
- LOGE("Failed to create voice for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to create voice for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -451,7 +451,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Add the text analysis resource to the voice. */
ret = pico_addResourceToVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME, picoTaResourceName );
if (PICO_OK != ret) {
- LOGE("Failed to add textana resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to add textana resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -463,7 +463,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
/* Add utpp resource to voice - optional: see note above. */
ret = pico_addResourceToVoiceDefinition( picoSystem, (const pico_Char *) PICO_VOICE_NAME, picoUtppResourceName );
if (PICO_OK != ret) {
- LOGE("Failed to add utpp resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to add utpp resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -471,7 +471,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
}
if (PICO_OK != ret) {
- LOGE("Failed to add siggen resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to add siggen resource to voice for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -479,7 +479,7 @@ static tts_result doLanguageSwitchFromLangIndex( int langIndex )
ret = pico_newEngine( picoSystem, (const pico_Char *) PICO_VOICE_NAME, &picoEngine );
if (PICO_OK != ret) {
- LOGE("Failed to create engine for %s [%d]", picoSupportedLang[langIndex], ret);
+ ALOGE("Failed to create engine for %s [%d]", picoSupportedLang[langIndex], ret);
cleanResources();
cleanFiles();
return TTS_FAILURE;
@@ -488,7 +488,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);
+ ALOGI("loaded %s successfully", picoProp_currLang);
return TTS_SUCCESS;
}
@@ -509,10 +509,10 @@ static tts_result doLanguageSwitch( const char * locale )
/* Load the new locale. */
loclIndex = checkForLocale( locale );
if (loclIndex < 0) {
- LOGE("Tried to swith to non-supported locale %s", locale);
+ ALOGE("Tried to swith to non-supported locale %s", locale);
return TTS_FAILURE;
}
- //LOGI("Found supported locale %s", picoSupportedLang[loclIndex]);
+ //ALOGI("Found supported locale %s", picoSupportedLang[loclIndex]);
return doLanguageSwitchFromLangIndex( loclIndex );
}
@@ -1045,19 +1045,19 @@ int cnvIpaToXsampa( const char16_t * ipaString, size_t ipaStringSize, char ** ou
tts_result TtsEngine::init( synthDoneCB_t synthDoneCBPtr, const char *config )
{
if (synthDoneCBPtr == NULL) {
- LOGE("Callback pointer is NULL");
+ ALOGE("Callback pointer is NULL");
return TTS_FAILURE;
}
picoMemArea = malloc( PICO_MEM_SIZE );
if (!picoMemArea) {
- LOGE("Failed to allocate memory for Pico system");
+ ALOGE("Failed to allocate memory for Pico system");
return TTS_FAILURE;
}
pico_Status ret = pico_initialize( picoMemArea, PICO_MEM_SIZE, &picoSystem );
if (PICO_OK != ret) {
- LOGE("Failed to initialize Pico system");
+ ALOGE("Failed to initialize Pico system");
free( picoMemArea );
picoMemArea = NULL;
return TTS_FAILURE;
@@ -1071,11 +1071,11 @@ tts_result TtsEngine::init( synthDoneCB_t synthDoneCBPtr, const char *config )
if ((config != NULL) && (strlen(config) > 0)) {
pico_alt_lingware_path = (char*)malloc(strlen(config));
strcpy((char*)pico_alt_lingware_path, config);
- LOGV("Alternative lingware path %s", pico_alt_lingware_path);
+ ALOGV("Alternative lingware path %s", pico_alt_lingware_path);
} else {
pico_alt_lingware_path = (char*)malloc(strlen(PICO_LINGWARE_PATH) + 1);
strcpy((char*)pico_alt_lingware_path, PICO_LINGWARE_PATH);
- LOGV("Using predefined lingware path %s", pico_alt_lingware_path);
+ ALOGV("Using predefined lingware path %s", pico_alt_lingware_path);
}
return TTS_SUCCESS;
@@ -1127,14 +1127,14 @@ tts_result TtsEngine::loadLanguage(const char *lang, const char *country, const
*/
tts_result TtsEngine::setLanguage( const char * lang, const char * country, const char * variant )
{
- //LOGI("TtsEngine::setLanguage %s %s %s", lang, country, variant);
+ //ALOGI("TtsEngine::setLanguage %s %s %s", lang, country, variant);
int langIndex;
int countryIndex;
int i;
if (lang == NULL)
{
- LOGE("TtsEngine::setLanguage called with NULL language");
+ ALOGE("TtsEngine::setLanguage called with NULL language");
return TTS_FAILURE;
}
@@ -1160,7 +1160,7 @@ tts_result TtsEngine::setLanguage( const char * lang, const char * country, cons
if (langIndex < 0)
{
/* The language isn't supported. */
- LOGE("TtsEngine::setLanguage called with unsupported language");
+ ALOGE("TtsEngine::setLanguage called with unsupported language");
return TTS_FAILURE;
}
@@ -1182,7 +1182,7 @@ tts_result TtsEngine::setLanguage( const char * lang, const char * country, cons
{
/* We didn't find a match on the country, but we had a match on the language.
Use that language. */
- LOGI("TtsEngine::setLanguage found matching language(%s) but not matching country(%s).",
+ ALOGI("TtsEngine::setLanguage found matching language(%s) but not matching country(%s).",
lang, country);
}
else
@@ -1211,7 +1211,7 @@ tts_support_result TtsEngine::isLanguageAvailable(const char *lang, const char *
// language matching
// if no language specified
if (lang == NULL) {
- LOGE("TtsEngine::isLanguageAvailable called with no language");
+ ALOGE("TtsEngine::isLanguageAvailable called with no language");
return TTS_LANG_NOT_SUPPORTED;
}
@@ -1225,7 +1225,7 @@ tts_support_result TtsEngine::isLanguageAvailable(const char *lang, const char *
}
if (langIndex < 0) {
// language isn't supported
- LOGV("TtsEngine::isLanguageAvailable called with unsupported language");
+ ALOGV("TtsEngine::isLanguageAvailable called with unsupported language");
return TTS_LANG_NOT_SUPPORTED;
}
@@ -1318,25 +1318,25 @@ tts_result TtsEngine::setProperty( const char * property, const char * value, co
Supported properties include: language (locale), rate, pitch, volume. */
/* Sanity check */
if (property == NULL) {
- LOGE("setProperty called with property NULL");
+ ALOGE("setProperty called with property NULL");
return TTS_PROPERTY_UNSUPPORTED;
}
if (value == NULL) {
- LOGE("setProperty called with value NULL");
+ ALOGE("setProperty called with value NULL");
return TTS_VALUE_INVALID;
}
if (strncmp(property, "language", 8) == 0) {
/* Verify it's in correct format. */
if (strlen(value) != 2 && strlen(value) != 6) {
- LOGE("change language called with incorrect format");
+ ALOGE("change language called with incorrect format");
return TTS_VALUE_INVALID;
}
/* Try to switch to specified language. */
if (doLanguageSwitch(value) == TTS_FAILURE) {
- LOGE("failed to load language");
+ ALOGE("failed to load language");
return TTS_FAILURE;
} else {
return TTS_SUCCESS;
@@ -1390,12 +1390,12 @@ tts_result TtsEngine::getProperty( const char * property, char * value, size_t *
This property was previously set by setProperty or by default. */
/* sanity check */
if (property == NULL) {
- LOGE("getProperty called with property NULL");
+ ALOGE("getProperty called with property NULL");
return TTS_PROPERTY_UNSUPPORTED;
}
if (value == NULL) {
- LOGE("getProperty called with value NULL");
+ ALOGE("getProperty called with value NULL");
return TTS_VALUE_INVALID;
}
@@ -1440,7 +1440,7 @@ tts_result TtsEngine::getProperty( const char * property, char * value, size_t *
}
/* Unknown property */
- LOGE("Unsupported property");
+ ALOGE("Unsupported property");
return TTS_PROPERTY_UNSUPPORTED;
}
@@ -1468,7 +1468,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
picoSynthAbort = 0;
if (text == NULL) {
- LOGE("synthesizeText called with NULL string");
+ ALOGE("synthesizeText called with NULL string");
return TTS_FAILURE;
}
@@ -1477,7 +1477,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
}
if (buffer == NULL) {
- LOGE("synthesizeText called with NULL buffer");
+ ALOGE("synthesizeText called with NULL buffer");
return TTS_FAILURE;
}
@@ -1489,21 +1489,21 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
if (err == XML_STATUS_ERROR) {
/* Note: for some reason expat always thinks the input document has an error
at the end, even when the XML document is perfectly formed */
- LOGI("Warning: SSML document parsed with errors");
+ ALOGI("Warning: SSML document parsed with errors");
}
char * parsed_text = parser->getParsedDocument();
if (parsed_text) {
/* Add property tags to the string - if any. */
local_text = (pico_Char *) doAddProperties( parsed_text );
if (!local_text) {
- LOGE("Failed to allocate memory for text string");
+ ALOGE("Failed to allocate memory for text string");
delete parser;
return TTS_FAILURE;
}
char * lang = parser->getParsedDocumentLanguage();
if (lang != NULL) {
if (doLanguageSwitch(lang) == TTS_FAILURE) {
- LOGE("Failed to switch to language (%s) specified in SSML document.", lang);
+ ALOGE("Failed to switch to language (%s) specified in SSML document.", lang);
delete parser;
return TTS_FAILURE;
}
@@ -1512,21 +1512,21 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
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.");
+ ALOGE("Failed to switch to default language.");
delete parser;
return TTS_FAILURE;
}
}
- //LOGI("No language in SSML, using current language (%s).", picoProp_currLang);
+ //ALOGI("No language in SSML, using current language (%s).", picoProp_currLang);
}
delete parser;
} else {
- LOGE("Failed to parse SSML document");
+ ALOGE("Failed to parse SSML document");
delete parser;
return TTS_FAILURE;
}
} else {
- LOGE("Failed to create SSML parser");
+ ALOGE("Failed to create SSML parser");
if (parser) {
delete parser;
}
@@ -1541,7 +1541,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
free( expanded_text );
}
if (!local_text) {
- LOGE("Failed to allocate memory for text string");
+ ALOGE("Failed to allocate memory for text string");
return TTS_FAILURE;
}
}
@@ -1562,7 +1562,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
/* Feed the text into the engine. */
ret = pico_putTextUtf8( picoEngine, inp, text_remaining, &bytes_sent );
if (ret != PICO_OK) {
- LOGE("Error synthesizing string '%s': [%d]", text, ret);
+ ALOGE("Error synthesizing string '%s': [%d]", text, ret);
if (local_text) {
free( local_text );
}
@@ -1588,7 +1588,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
cbret = picoSynthDoneCBPtr(userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer,
bufused, TTS_SYNTH_PENDING);
if (cbret == TTS_CALLBACK_HALT) {
- LOGI("Halt requested by caller. Halting.");
+ ALOGI("Halt requested by caller. Halting.");
picoSynthAbort = 1;
ret = pico_resetEngine( picoEngine, PICO_RESET_SOFT );
break;
@@ -1610,12 +1610,12 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
if (ret != PICO_STEP_IDLE) {
if (ret != 0){
- LOGE("Error occurred during synthesis [%d]", ret);
+ ALOGE("Error occurred during synthesis [%d]", ret);
}
if (local_text) {
free(local_text);
}
- LOGV("Synth loop: sending TTS_SYNTH_DONE after error");
+ ALOGV("Synth loop: sending TTS_SYNTH_DONE after error");
picoSynthDoneCBPtr( userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused,
TTS_SYNTH_DONE);
pico_resetEngine( picoEngine, PICO_RESET_SOFT );
@@ -1624,7 +1624,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t
}
/* Synthesis is done; notify the caller */
- LOGV("Synth loop: sending TTS_SYNTH_DONE after all done, or was asked to stop");
+ ALOGV("Synth loop: sending TTS_SYNTH_DONE after all done, or was asked to stop");
picoSynthDoneCBPtr( userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused,
TTS_SYNTH_DONE);
diff --git a/pico/tts/svox_ssml_parser.cpp b/pico/tts/svox_ssml_parser.cpp
index d5c9399..1e86940 100755
--- a/pico/tts/svox_ssml_parser.cpp
+++ b/pico/tts/svox_ssml_parser.cpp
@@ -85,7 +85,7 @@ int SvoxSsmlParser::parseDocument(const char* ssmldoc, int isFinal)
if (status == XML_STATUS_ERROR)
{
/* Note: for some reason Expat almost always complains about invalid tokens, even when document is well formed */
- LOGI("Parser error at line %d: %s\n", (int)XML_GetCurrentLineNumber(mParser), XML_ErrorString(XML_GetErrorCode(mParser)));
+ ALOGI("Parser error at line %d: %s\n", (int)XML_GetCurrentLineNumber(mParser), XML_ErrorString(XML_GetErrorCode(mParser)));
}
return status;
}
@@ -118,7 +118,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
m_data = new char[m_datasize];
if (!m_data)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -143,7 +143,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -155,7 +155,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -188,7 +188,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
if (!ph)
{
/* error, no phonetic string */
- LOGE("Error: bad SSML syntax, ph attribute not supplied.");
+ ALOGE("Error: bad SSML syntax, ph attribute not supplied.");
return;
}
@@ -199,7 +199,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
delete [] ph;
if (!xsampastr)
{
- LOGE("Error: failed to allocate memory for IPA string conversion");
+ ALOGE("Error: failed to allocate memory for IPA string conversion");
return;
}
}
@@ -229,7 +229,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!");
+ ALOGE("Error: failed to allocate memory for string!");
free(xsampastr);
return;
}
@@ -241,7 +241,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!");
+ ALOGE("Error: failed to allocate memory for string!");
free(xsampastr);
return;
}
@@ -258,7 +258,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -273,7 +273,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -287,7 +287,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
time = new char[strlen(attributes[i+1]) + 1];
if (!time)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strcpy(time, attributes[i+1]);
@@ -302,7 +302,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
time = new char[6];
if (!time)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strcpy(time, SSML_BREAK_WEAK); /* if no time or strength attributes are specified, default to weak break */
@@ -311,7 +311,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -328,7 +328,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
char* svoxpitch = convertToSvoxPitch(attributes[i+1]);
if (!svoxpitch)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
if (!svoxpitch)
@@ -336,7 +336,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
svoxpitch = new char[4];
if (!svoxpitch)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strcpy(svoxpitch, "100");
@@ -344,7 +344,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
char* pitch = new char[17 + strlen(svoxpitch)];
if (!pitch)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
sprintf(pitch, "<pitch level='%s'>", svoxpitch);
@@ -352,7 +352,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -374,7 +374,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
svoxrate = new char[4];
if (!svoxrate)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strcpy(svoxrate, "100");
@@ -382,7 +382,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
char* rate = new char[17 + strlen(svoxrate)];
if (!rate)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
sprintf(rate, "<speed level='%s'>", svoxrate);
@@ -390,7 +390,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -400,7 +400,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
m_appendix = new char[30];
if (!m_appendix)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
m_appendix[0] = '\0';
@@ -417,7 +417,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
svoxvol = new char[4];
if (!svoxvol)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strcpy(svoxvol, "100");
@@ -425,7 +425,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
char* volume = new char[18 + strlen(svoxvol)];
if (!volume)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
sprintf(volume, "<volume level='%s'>", svoxvol);
@@ -433,7 +433,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -455,7 +455,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -469,7 +469,7 @@ void SvoxSsmlParser::startElement(const XML_Char* element, const XML_Char** attr
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -497,7 +497,7 @@ void SvoxSsmlParser::endElement(const XML_Char* element)
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -509,7 +509,7 @@ void SvoxSsmlParser::endElement(const XML_Char* element)
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -531,7 +531,7 @@ void SvoxSsmlParser::endElement(const XML_Char* element)
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -546,7 +546,7 @@ void SvoxSsmlParser::endElement(const XML_Char* element)
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -569,7 +569,7 @@ void SvoxSsmlParser::textElement(const XML_Char* text, int length)
char* content = new char[length + 1];
if (!content)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
strncpy(content, text, length);
@@ -579,7 +579,7 @@ void SvoxSsmlParser::textElement(const XML_Char* text, int length)
{
if (!growDataSize(100))
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return;
}
}
@@ -599,7 +599,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_XLOW);
@@ -609,7 +609,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_LOW);
@@ -619,7 +619,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_MEDIUM);
@@ -629,7 +629,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_MEDIUM);
@@ -639,7 +639,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_HIGH);
@@ -649,7 +649,7 @@ char* SvoxSsmlParser::convertToSvoxPitch(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_PITCH_XHIGH);
@@ -669,7 +669,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_XSLOW);
@@ -679,7 +679,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_SLOW);
@@ -689,7 +689,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_MEDIUM);
@@ -699,7 +699,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_MEDIUM);
@@ -709,7 +709,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_FAST);
@@ -719,7 +719,7 @@ char* SvoxSsmlParser::convertToSvoxRate(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_RATE_XFAST);
@@ -739,7 +739,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_SILENT);
@@ -749,7 +749,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_XLOW);
@@ -759,7 +759,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_LOW);
@@ -769,7 +769,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_MEDIUM);
@@ -779,7 +779,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_MEDIUM);
@@ -789,7 +789,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_LOUD);
@@ -799,7 +799,7 @@ char* SvoxSsmlParser::convertToSvoxVolume(const char* value)
converted = new char[4];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_VOLUME_XLOUD);
@@ -819,7 +819,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_NONE);
@@ -829,7 +829,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_XWEAK);
@@ -839,7 +839,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_WEAK);
@@ -849,7 +849,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_MEDIUM);
@@ -859,7 +859,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_STRONG);
@@ -869,7 +869,7 @@ char* SvoxSsmlParser::convertBreakStrengthToTime(const char* value)
converted = new char[6];
if (!converted)
{
- LOGE("Error: failed to allocate memory for string!\n");
+ ALOGE("Error: failed to allocate memory for string!\n");
return NULL;
}
strcpy(converted, SSML_BREAK_XSTRONG);