Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35a8e80b authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Updating TTS engine interface for setting the language based on language, country and variant codes

coming from a java.util.Locale instance.
parent 9908b3d8
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -100,13 +100,17 @@ public:
    // @return TTS_SUCCESS, or TTS_FAILURE
    virtual tts_result loadLanguage(const char *value, const size_t size);
    
    // Signal the engine to use the specified language. This will force the
    // language to be loaded if it wasn't loaded previously with loadLanguage().
    // See loadLanguage for the specification of the language.
    // @param value pointer to the language value
    // @param size  length of the language value
    // Load the resources associated with the specified language, country and Locale variant.
    // The loaded language will only be used once a call to setLanguageFromLocale() with the same
    // language value is issued. Language and country values are coded according to the ISO three
    // letter codes for languages and countries, as can be retrieved from a java.util.Locale
    // instance. The variant value is encoded as the variant string retrieved from a
    // java.util.Locale instance built with that variant data.
    // @param lang pointer to the ISO three letter code for the language
    // @param country pointer to the ISO three letter code for the country
    // @param variant pointer to the variant code
    // @return TTS_SUCCESS, or TTS_FAILURE
    virtual tts_result setLanguage(const char *value, const size_t size);
    virtual tts_result setLanguage(const char *lang, const char *country, const char *variant);

    // Retrieve the currently set language, or an empty "value" if no language
    // has been set.
+5 −3
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ android_tts_SynthProxy_native_finalize(JNIEnv *env, jobject thiz, jint jniData)
    }
}


// TODO update to use language, country, variant
static void
android_tts_SynthProxy_setLanguage(JNIEnv *env, jobject thiz, jint jniData,
        jstring language)
@@ -283,8 +283,10 @@ android_tts_SynthProxy_setLanguage(JNIEnv *env, jobject thiz, jint jniData,
    const char *langNativeString = env->GetStringUTFChars(language, 0);
    // TODO check return codes
    if (pSynthData->mNativeSynthInterface) {
        pSynthData->mNativeSynthInterface->setLanguage(langNativeString,
                strlen(langNativeString));
        // TODO update to use language, country, variant
        //      commented out to not break the build
        //pSynthData->mNativeSynthInterface->setLanguage(langNativeString,
        //        strlen(langNativeString));
    }
    env->ReleaseStringUTFChars(language, langNativeString);
}