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 @@
         }
         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 @@
         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 @@
     // 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 @@
                android_tts_synth_status_t status)
 {
     if (*pUserdata == NULL){
-        LOGE("userdata == NULL");
+        ALOGE("userdata == NULL");
         return ANDROID_TTS_CALLBACK_HALT;
     }
 
@@ -322,7 +322,7 @@
         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 @@
     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 @@
 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 @@
     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 @@
     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 @@
      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 @@
         }
 
         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 @@
     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 @@
         /*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 @@
         (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 @@
     /* 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 @@
     /* 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 @@
        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 @@
     /* 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 @@
         /* 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 @@
     /* 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 @@
     /* 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 @@
         /* 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 @@
     }
 
     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 @@
 
     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 @@
     /* 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 @@
     /* 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 @@
 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 @@
     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::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 @@
     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 @@
             {
             /* 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 @@
     // 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 @@
     }
     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 @@
        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 @@
        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 @@
     }
 
     /* Unknown property */
-    LOGE("Unsupported property");
+    ALOGE("Unsupported property");
     return TTS_PROPERTY_UNSUPPORTED;
 }
 
@@ -1468,7 +1468,7 @@
 
     picoSynthAbort = 0;
     if (text == NULL) {
-        LOGE("synthesizeText called with NULL string");
+        ALOGE("synthesizeText called with NULL string");
         return TTS_FAILURE;
     }
 
@@ -1477,7 +1477,7 @@
     }
 
     if (buffer == NULL) {
-        LOGE("synthesizeText called with NULL buffer");
+        ALOGE("synthesizeText called with NULL buffer");
         return TTS_FAILURE;
     }
 
@@ -1489,21 +1489,21 @@
             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 @@
                     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 @@
             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 @@
         /* 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 @@
                     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 @@
 
         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 @@
     }
 
     /* 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 @@
     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 @@
             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 @@
         {
             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 @@
         {
             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 @@
         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 @@
       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 @@
             {
                 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 @@
             {
                 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 @@
           {
         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 @@
         {
             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 @@
                 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 @@
             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 @@
         {
             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 @@
                 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 @@
                     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 @@
                 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 @@
                 {
                     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 @@
                     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 @@
                 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 @@
                 {
                     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 @@
                     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 @@
                     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 @@
                 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 @@
                 {
                     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 @@
         {
             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 @@
                 {
                     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 @@
         {
             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 @@
         {
             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 @@
             {
                 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 @@
         {
             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 @@
     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 @@
     {
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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);
