1f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert/* 2f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * Copyright (C) 2009 Google Inc. 3f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * 4f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * Licensed under the Apache License, Version 2.0 (the "License"); 5f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * you may not use this file except in compliance with the License. 6f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * You may obtain a copy of the License at 7f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * 8f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * http://www.apache.org/licenses/LICENSE-2.0 9f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * 10f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * Unless required by applicable law or agreed to in writing, software 11f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * distributed under the License is distributed on an "AS IS" BASIS, 12f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * See the License for the specific language governing permissions and 14f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert * limitations under the License. 15f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert */ 16f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 17f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// This header defines the interface used by the Android platform 18f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// to access Text-To-Speech functionality in shared libraries that implement 19f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// speech synthesis and the management of resources associated with the 20f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// synthesis. 21f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// An example of the implementation of this interface can be found in 22f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// FIXME: add path+name to implementation of default TTS engine 23f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// Libraries implementing this interface are used in: 24f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// frameworks/base/tts/jni/android_tts_SpeechSynthesis.cpp 25f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 26f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertnamespace android { 27f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 28f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert#define ANDROID_TTS_ENGINE_PROPERTY_CONFIG "engineConfig" 29f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert#define ANDROID_TTS_ENGINE_PROPERTY_PITCH "pitch" 30f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert#define ANDROID_TTS_ENGINE_PROPERTY_RATE "rate" 31f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert#define ANDROID_TTS_ENGINE_PROPERTY_VOLUME "volume" 32f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 33f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 34f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertenum tts_synth_status { 35f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_SYNTH_DONE = 0, 36f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_SYNTH_PENDING = 1 37f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert}; 38f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 39f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertenum tts_callback_status { 40f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_CALLBACK_HALT = 0, 41f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_CALLBACK_CONTINUE = 1 42f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert}; 43f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 447ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath// NOTE: This is duplicated in compat/jni/tts.h. Please 457ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath// make changes there as well. 467ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamathenum tts_audio_format { 477ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath TTS_AUDIO_FORMAT_INVALID = -1, 487ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath TTS_AUDIO_FORMAT_DEFAULT = 0, 497ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath TTS_AUDIO_FORMAT_PCM_16_BIT = 1, 507ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath TTS_AUDIO_FORMAT_PCM_8_BIT = 2, 517ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath}; 527ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath 53f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// The callback is used by the implementation of this interface to notify its 54f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// client, the Android TTS service, that the last requested synthesis has been 55f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// completed. // TODO reword 56f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// The callback for synthesis completed takes: 57f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [inout] void *& - The userdata pointer set in the original 58f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// synth call 59f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [in] uint32_t - Track sampling rate in Hz 607ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath// @param [in] tts_audio_format - The audio format 61f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [in] int - The number of channels 62f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [inout] int8_t *& - A buffer of audio data only valid during the 63f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// execution of the callback 64f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [inout] size_t & - The size of the buffer 65f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @param [in] tts_synth_status - indicate whether the synthesis is done, or 66f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// if more data is to be synthesized. 67f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// @return TTS_CALLBACK_HALT to indicate the synthesis must stop, 68f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// TTS_CALLBACK_CONTINUE to indicate the synthesis must continue if 69f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert// there is more data to produce. 70f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringerttypedef tts_callback_status (synthDoneCB_t)(void *&, uint32_t, 717ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath tts_audio_format, int, int8_t *&, size_t&, tts_synth_status); 72f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 73f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertclass TtsEngine; 74f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertextern "C" TtsEngine* getTtsEngine(); 75f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 76f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertenum tts_result { 77f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_SUCCESS = 0, 78f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_FAILURE = -1, 79f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_FEATURE_UNSUPPORTED = -2, 80f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_VALUE_INVALID = -3, 81f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_PROPERTY_UNSUPPORTED = -4, 82f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_PROPERTY_SIZE_TOO_SMALL = -5, 83f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_MISSING_RESOURCES = -6 84f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert}; 85f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 86f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertenum tts_support_result { 87f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_LANG_COUNTRY_VAR_AVAILABLE = 2, 88f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_LANG_COUNTRY_AVAILABLE = 1, 89f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_LANG_AVAILABLE = 0, 90f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_LANG_MISSING_DATA = -1, 91f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert TTS_LANG_NOT_SUPPORTED = -2 92f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert}; 93f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 947ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath 95f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertclass TtsEngine 96f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert{ 97f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringertpublic: 98f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual ~TtsEngine() {} 99f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 100f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Initialize the TTS engine and returns whether initialization succeeded. 101f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param synthDoneCBPtr synthesis callback function pointer 102f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 103f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result init(synthDoneCB_t synthDoneCBPtr, const char *engineConfig); 104f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 105f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Shut down the TTS engine and releases all associated resources. 106f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 107f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result shutdown(); 108f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 109f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Interrupt synthesis and flushes any synthesized data that hasn't been 110f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // output yet. This will block until callbacks underway are completed. 111f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 112f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result stop(); 113f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 114f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Returns the level of support for the language, country and variant. 115f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_LANG_COUNTRY_VAR_AVAILABLE if the language, country and variant are supported, 116f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // and the corresponding resources are correctly installed 117f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // TTS_LANG_COUNTRY_AVAILABLE if the language and country are supported and the 118f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // corresponding resources are correctly installed, but there is no match for 119f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // the specified variant 120f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // TTS_LANG_AVAILABLE if the language is supported and the 121f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // corresponding resources are correctly installed, but there is no match for 122f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // the specified country and variant 123f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // TTS_LANG_MISSING_DATA if the required resources to provide any level of support 124f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // for the language are not correctly installed 125f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // TTS_LANG_NOT_SUPPORTED if the language is not supported by the TTS engine. 126f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_support_result isLanguageAvailable(const char *lang, const char *country, 127f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert const char *variant); 128f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 129f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Load the resources associated with the specified language. The loaded 130f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // language will only be used once a call to setLanguage() with the same 131f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // language value is issued. Language and country values are coded according to the ISO three 132f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // letter codes for languages and countries, as can be retrieved from a java.util.Locale 133f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // instance. The variant value is encoded as the variant string retrieved from a 134f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // java.util.Locale instance built with that variant data. 135f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param lang pointer to the ISO three letter code for the language 136f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param country pointer to the ISO three letter code for the country 137f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param variant pointer to the variant code 138f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 139f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result loadLanguage(const char *lang, const char *country, const char *variant); 140f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 141f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Load the resources associated with the specified language, country and Locale variant. 142f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // The loaded language will only be used once a call to setLanguageFromLocale() with the same 143f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // language value is issued. Language and country values are coded according to the ISO three 144f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // letter codes for languages and countries, as can be retrieved from a java.util.Locale 145f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // instance. The variant value is encoded as the variant string retrieved from a 146f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // java.util.Locale instance built with that variant data. 147f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param lang pointer to the ISO three letter code for the language 148f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param country pointer to the ISO three letter code for the country 149f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param variant pointer to the variant code 150f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 151f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result setLanguage(const char *lang, const char *country, const char *variant); 152f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 153f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Retrieve the currently set language, country and variant, or empty strings if none of 154f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // parameters have been set. Language and country are represented by their 3-letter ISO code 155f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[out] pointer to the retrieved 3-letter code language value 156f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[out] pointer to the retrieved 3-letter code country value 157f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[out] pointer to the retrieved variant value 158f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 159f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result getLanguage(char *language, char *country, char *variant); 160f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 161f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Notifies the engine what audio parameters should be used for the synthesis. 162f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // This is meant to be used as a hint, the engine implementation will set the output values 163f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // to those of the synthesis format, based on a given hint. 164f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[inout] encoding in: the desired audio sample format 165f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // out: the format used by the TTS engine 166f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[inout] rate in: the desired audio sample rate 167f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // out: the sample rate used by the TTS engine 168f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[inout] channels in: the desired number of audio channels 169f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // out: the number of channels used by the TTS engine 170f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS, or TTS_FAILURE 1717ffd31ba2584359996e04cd3d4d92f810d651066Narayan Kamath virtual tts_result setAudioFormat(tts_audio_format& encoding, uint32_t& rate, 172f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert int& channels); 173f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 174f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Set a property for the the TTS engine 175f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // "size" is the maximum size of "value" for properties "property" 176f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param property pointer to the property name 177f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param value pointer to the property value 178f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param size maximum size required to store this type of property 179f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_PROPERTY_UNSUPPORTED, or TTS_SUCCESS, or TTS_FAILURE, 180f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // or TTS_VALUE_INVALID 181f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result setProperty(const char *property, const char *value, 182f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert const size_t size); 183f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 184f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Retrieve a property from the TTS engine 185f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param property pointer to the property name 186f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[out] value pointer to the retrieved language value 187f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param[inout] iosize in: stores the size available to store the 188f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // property value. 189f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // out: stores the size required to hold the language 190f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // value if getLanguage() returned 191f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // TTS_PROPERTY_SIZE_TOO_SMALL, unchanged otherwise 192f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_PROPERTY_UNSUPPORTED, or TTS_SUCCESS, 193f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // or TTS_PROPERTY_SIZE_TOO_SMALL 194f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result getProperty(const char *property, char *value, 195f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert size_t *iosize); 196f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 197f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Synthesize the text. 198f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // As the synthesis is performed, the engine invokes the callback to notify 199f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // the TTS framework that it has filled the given buffer, and indicates how 200f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // many bytes it wrote. The callback is called repeatedly until the engine 201f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // has generated all the audio data corresponding to the text. 202f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Note about the format of the input: the text parameter may use the 203f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // following elements 204f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // and their respective attributes as defined in the SSML 1.0 specification: 205f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * lang 206f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * say-as: 207f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o interpret-as 208f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * phoneme 209f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * voice: 210f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o gender, 211f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o age, 212f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o variant, 213f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o name 214f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * emphasis 215f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * break: 216f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o strength, 217f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o time 218f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * prosody: 219f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o pitch, 220f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o contour, 221f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o range, 222f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o rate, 223f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o duration, 224f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // o volume 225f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * mark 226f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Differences between this text format and SSML are: 227f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * full SSML documents are not supported 228f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // * namespaces are not supported 229f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // Text is coded in UTF-8. 230f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param text the UTF-8 text to synthesize 231f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param userdata pointer to be returned when the call is invoked 232f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param buffer the location where the synthesized data must be written 233f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @param bufferSize the number of bytes that can be written in buffer 234f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert // @return TTS_SUCCESS or TTS_FAILURE 235f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert virtual tts_result synthesizeText(const char *text, int8_t *buffer, 236f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert size_t bufferSize, void *userdata); 237f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 238f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert}; 239f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert 240f41e1f808fbcf9014c0a5668fba4eff6dd051366Bjorn Bringert} // namespace android 241