diff options
Diffstat (limited to 'include/tts/TtsEngine.h')
-rw-r--r-- | include/tts/TtsEngine.h | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/include/tts/TtsEngine.h b/include/tts/TtsEngine.h index 8486532..21cb73b 100644 --- a/include/tts/TtsEngine.h +++ b/include/tts/TtsEngine.h @@ -69,6 +69,14 @@ enum tts_result { TTS_MISSING_RESOURCES = -6 }; +enum tts_support_result { + TTS_LANG_COUNTRY_VAR_AVAILABLE = 2, + TTS_LANG_COUNTRY_AVAILABLE = 1, + TTS_LANG_AVAILABLE = 0, + TTS_LANG_MISSING_DATA = -1, + TTS_LANG_NOT_SUPPORTED = -2 +}; + class TtsEngine { public: @@ -86,19 +94,32 @@ public: // @return TTS_SUCCESS, or TTS_FAILURE virtual tts_result stop(); + // Returns the level of support for the language, country and variant. + // @return TTS_LANG_COUNTRY_VAR_AVAILABLE if the language, country and variant are supported, + // and the corresponding resources are correctly installed + // TTS_LANG_COUNTRY_AVAILABLE if the language and country are supported and the + // corresponding resources are correctly installed, but there is no match for + // the specified variant + // TTS_LANG_AVAILABLE if the language is supported and the + // corresponding resources are correctly installed, but there is no match for + // the specified country and variant + // TTS_LANG_MISSING_DATA if the required resources to provide any level of support + // for the language are not correctly installed + // TTS_LANG_NOT_SUPPORTED if the language is not supported by the TTS engine. + virtual tts_support_result isLanguageAvailable(const char *lang, const char *country, + const char *variant); + // Load the resources associated with the specified language. The loaded // language will only be used once a call to setLanguage() with the same - // language value is issued. Language values are based on the Android - // conventions for localization as described in the Android platform - // documentation on internationalization. This implies that language - // data is specified in the format xx-rYY, where xx is a two letter - // ISO 639-1 language code in lowercase and rYY is a two letter - // ISO 3166-1-alpha-2 language code in uppercase preceded by a - // lowercase "r". - // @param value pointer to the language value - // @param size length of the language value + // 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 loadLanguage(const char *value, const size_t size); + virtual tts_result loadLanguage(const char *lang, const char *country, const char *variant); // 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 @@ -112,16 +133,26 @@ public: // @return TTS_SUCCESS, or TTS_FAILURE 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. - // @param[out] value pointer to the retrieved language value - // @param[inout] iosize in: stores the size available to store the language - // value in *value - // out: stores the size required to hold the language - // value if getLanguage() returned - // TTS_PROPERTY_SIZE_TOO_SMALL, unchanged otherwise. - // @return TTS_SUCCESS, or TTS_PROPERTY_SIZE_TOO_SMALL, or TTS_FAILURE - virtual tts_result getLanguage(char *value, size_t *iosize); + // Retrieve the currently set language, country and variant, or empty strings if none of + // parameters have been set. Language and country are represented by their 3-letter ISO code + // @param[out] pointer to the retrieved 3-letter code language value + // @param[out] pointer to the retrieved 3-letter code country value + // @param[out] pointer to the retrieved variant value + // @return TTS_SUCCESS, or TTS_FAILURE + virtual tts_result getLanguage(char *language, char *country, char *variant); + + // Notifies the engine what audio parameters should be used for the synthesis. + // This is meant to be used as a hint, the engine implementation will set the output values + // to those of the synthesis format, based on a given hint. + // @param[inout] encoding in: the desired audio sample format + // out: the format used by the TTS engine + // @param[inout] rate in: the desired audio sample rate + // out: the sample rate used by the TTS engine + // @param[inout] channels in: the desired number of audio channels + // out: the number of channels used by the TTS engine + // @return TTS_SUCCESS, or TTS_FAILURE + virtual tts_result setAudioFormat(AudioSystem::audio_format& encoding, uint32_t& rate, + int& channels); // Set a property for the the TTS engine // "size" is the maximum size of "value" for properties "property" |