2 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_UIX_TTS_DOC_H__
19 #define __TIZEN_UIX_TTS_DOC_H__
22 * @defgroup CAPI_UIX_TTS_MODULE TTS
23 * @ingroup CAPI_UIX_FRAMEWORK
24 * @brief The @ref CAPI_UIX_TTS_MODULE API provides functions for synthesizing voice from text and playing synthesized sound data.
26 * @section CAPI_UIX_TTS_MODULE_HEADER Required Header
29 * @section CAPI_UIX_TTS_MODULE_OVERVIEW Overview
30 * You can use Text-To-Speech (TTS) API to read sound data transformed by the engine from input texts.
31 * Applications can add input-text to queue for reading continuously and control the player that can play, pause, and stop sound data synthesized from text.
33 * To use TTS, follow these steps:<br>
34 * 1. Create a handle <br>
35 * 2. Register callback functions for notifications <br>
36 * 3. Prepare tts-daemon asynchronously <br>
37 * 4. Add text to queue for speech <br>
38 * 5. Start synthesizing voice from text and play synthesized sound data <br>
39 * 6. Pause the player <br>
40 * 7. Resume the player <br>
41 * 8. Stop the player <br>
42 * 9. Destroy a handle <br>
44 * The TTS API also notifies you (by callback mechanism) when the state of TTS is changed,
45 * utterance is started and completed, default voice is changed or an error occured.
46 * An application should register callback functions: tts_state_changed_cb(), tts_utterance_started_cb(),
47 * tts_utterance_completed_cb(), tts_default_voice_changed_cb(), tts_error_cb().
49 * @section CAPI_UIX_TTS_MODULE_STATE_DIAGRAM State Diagram
50 * The following diagram shows the life cycle and the states of the TTS.
51 * This state diagram shows that the state can be changed from 'None' to 'Created' by calling the tts_create() function.
52 * Similarly, you can know the relation between the states and API functions.
53 * You need to know the current state before calling the API, because the TTS API is based on state machine.
54 * The current state can be known from the state changed callback.
56 * @image html capi_uix_tts_state_diagram.png "State diagram"
58 * @section CAPI_UIX_TTS_MODULE_STATE_TRANSITIONS State Transitions
59 * The following table shows previous state and post state of main function.
60 * It can be known what precondition is and which synchronous type is.
61 * Please check both previous state and post state from the table carefully.
62 * In case of tts_prepare() function, state doesn't be changed at once, but acynchronously.
63 * From the above state diagram, you can see dotted line as asynchronous api.
64 * In this case, the state changed callback is only way to know state transition as ready.
74 * <td>tts_prepare()</td>
81 * <td>Ready, Paused</td>
87 * <td>Ready, Playing, Paused</td>
92 * <td>tts_pause()</td>
99 * @section CAPI_UIX_TTS_MODULE_STATE_DEPENDENT_FUNCTION_CALLS State Dependent Function Calls
100 * The following table shows state-dependent function calls.
101 * It is forbidden to call functions listed below in wrong states.
102 * Violation of this rule may result in an unpredictable behavior.
107 * <th>VALID STATES</th>
108 * <th>DESCRIPTION</th>
111 * <td>tts_create()</td>
113 * <td>All functions must be called after tts_create()</td>
116 * <td>tts_destroy()</td>
117 * <td>Created, Ready, Playing, Paused</td>
121 * <td>tts_set_mode()</td>
123 * <td>The application should set mode to use TTS for screen reader or notification like driving mode.</td>
126 * <td>tts_get_mode()</td>
131 * <td>tts_prepare()</td>
133 * <td>This function works asynchronously. If daemon fork is failed, application gets the error callback.</td>
136 * <td>tts_unprepare()</td>
141 * <td>tts_foreach_supported_voices()</td>
142 * <td>Created, Ready, Playing, Paused</td>
146 * <td>tts_get_default_voice()</td>
147 * <td>Created, Ready, Playing, Paused</td>
151 * <td>tts_get_state()</td>
152 * <td>Created, Ready, Playing, Paused</td>
156 * <td>tts_get_max_text_size()</td>
161 * <td>tts_get_speed_range()</td>
166 * <td>tts_add_text()</td>
167 * <td>Ready, Playing, Paused</td>
171 * <td>tts_play()</td>
172 * <td>Ready, Paused</td>
176 * <td>tts_stop()</td>
177 * <td>Ready, Playing, Paused</td>
181 * <td>tts_pause()</td>
187 * tts_set_state_changed_cb()<br>
188 * tts_unset_state_changed_cb()<br>
189 * tts_set_utterance_started_cb()<br>
190 * tts_unset_utterance_started_cb()<br>
191 * tts_set_utterance_completed_cb()<br>
192 * tts_unset_utterance_completed_cb()<br>
193 * tts_set_default_voice_changed_cb()<br>
194 * tts_unset_default_voice_changed_cb()<br>
195 * tts_set_error_cb()<br>
196 * tts_unset_error_cb()</td>
198 * <td> All callback function should be registered in Created state </td>
202 * @section CAPI_UIX_TTS_MODULE_FEATURE Related Features
203 * This API is related with the following features:<br>
204 * - http://tizen.org/feature/speech.synthesis<br>
206 * It is recommended to design feature related codes in your application for reliability.<br>
207 * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.<br>
208 * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.<br>
209 * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
213 #endif /* __TIZEN_UIX_TTS_DOC_H__ */