2 * Copyright (c) 2011-2016 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.
28 * @addtogroup CAPI_UIX_TTS_MODULE
37 * @brief Enumeration for error code.
38 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
41 TTS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
42 TTS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
43 TTS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
44 TTS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
45 TTS_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
46 TTS_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
47 TTS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */
48 TTS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< TTS NOT supported */
49 TTS_ERROR_INVALID_STATE = TIZEN_ERROR_TTS | 0x01, /**< Invalid state */
50 TTS_ERROR_INVALID_VOICE = TIZEN_ERROR_TTS | 0x02, /**< Invalid voice */
51 TTS_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_TTS | 0x03, /**< No available engine */
52 TTS_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
53 TTS_ERROR_AUDIO_POLICY_BLOCKED = TIZEN_ERROR_TTS | 0x05, /**< Audio policy blocked */
54 TTS_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature of current engine @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
55 TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07 /**< Service reset @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
59 * @brief Enumeration for TTS mode.
60 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
63 TTS_MODE_DEFAULT = 0, /**< Default mode for normal application */
64 TTS_MODE_NOTIFICATION = 1, /**< Notification mode */
65 TTS_MODE_SCREEN_READER = 2 /**< Accessibiliity mode */
69 * @brief Enumerations for state.
70 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
73 TTS_STATE_CREATED = 0, /**< 'CREATED' state */
74 TTS_STATE_READY = 1, /**< 'READY' state */
75 TTS_STATE_PLAYING = 2, /**< 'PLAYING' state */
76 TTS_STATE_PAUSED = 3 /**< 'PAUSED' state*/
80 * @brief Definitions for automatic speaking speed.
81 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
83 #define TTS_SPEED_AUTO 0
86 * @brief Definitions for automatic voice type.
87 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
89 #define TTS_VOICE_TYPE_AUTO 0
92 * @brief Definitions for male voice type.
93 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
95 #define TTS_VOICE_TYPE_MALE 1
98 * @brief Definitions for female voice type.
99 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
101 #define TTS_VOICE_TYPE_FEMALE 2
104 * @brief Definitions for child voice type.
105 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
107 #define TTS_VOICE_TYPE_CHILD 3
110 * @brief The TTS handle.
111 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
113 typedef struct tts_s *tts_h;
117 * @brief Called when the state of TTS is changed.
118 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
120 * @details If the daemon must stop player because of changing engine and
121 * the daemon must pause player because of other requests, this callback function is called.
123 * @param[in] tts The TTS handle
124 * @param[in] previous The previous state
125 * @param[in] current The current state
126 * @param[in] user_data The user data passed from the callback registration function
128 * @pre An application registers this callback using tts_set_state_changed_cb() to detect changing state.
130 * @see tts_set_state_changed_cb()
131 * @see tts_unset_state_changed_cb()
133 typedef void (*tts_state_changed_cb)(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data);
136 * @brief Called when utterance has started.
137 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
139 * @param[in] tts The TTS handle
140 * @param[in] utt_id The utterance ID passed from the add text function
141 * @param[in] user_data The user data passed from the callback registration function
143 * @pre An application registers this callback using tts_set_utterance_started_cb() to detect utterance started.
145 * @see tts_add_text()
146 * @see tts_set_utterance_started_cb()
147 * @see tts_unset_utterance_started_cb()
149 typedef void (*tts_utterance_started_cb)(tts_h tts, int utt_id, void* user_data);
152 * @brief Called when utterance is finished.
153 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
155 * @param[in] tts The TTS handle
156 * @param[in] utt_id The utterance ID passed from the add text function
157 * @param[in] user_data The user data passed from the callback registration function
159 * @pre An application registers this callback using tts_set_utterance_completed_cb() to detect utterance completed.
161 * @see tts_add_text()
162 * @see tts_set_utterance_completed_cb()
163 * @see tts_unset_utterance_completed_cb()
165 typedef void (*tts_utterance_completed_cb)(tts_h tts, int utt_id, void *user_data);
168 * @brief Called when an error occurs.
169 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
171 * @param[in] tts The TTS handle
172 * @param[in] utt_id The utterance ID passed from the add text function
173 * @param[in] reason The error code
174 * @param[in] user_data The user data passed from the callback registration function
176 * @pre An application registers this callback using tts_set_error_cb() to detect error.
181 * @see tts_set_error_cb()
182 * @see tts_unset_error_cb()
184 typedef void (*tts_error_cb)(tts_h tts, int utt_id, tts_error_e reason, void* user_data);
187 * @brief Called to retrieve the supported voice.
188 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
190 * @param[in] tts The TTS handle
191 * @param[in] language Language specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code (for example, "ko_KR" for Korean, "en_US" for American English)
192 * @param[in] voice_type A voice type (e.g. #TTS_VOICE_TYPE_MALE, #TTS_VOICE_TYPE_FEMALE)
193 * @param[in] user_data The user data passed from the foreach function
195 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
196 * @pre tts_foreach_supported_voices() will invoke this callback function.
198 * @see tts_foreach_supported_voices()
200 typedef bool(*tts_supported_voice_cb)(tts_h tts, const char* language, int voice_type, void* user_data);
203 * @brief Called when the default voice is changed.
204 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
206 * @param[in] tts The TTS handle
207 * @param[in] previous_language The previous language
208 * @param[in] previous_voice_type The previous voice type
209 * @param[in] current_language The current language
210 * @param[in] current_voice_type The current voice type
211 * @param[in] user_data The user data passed from the callback registration function
213 * @see tts_set_default_voice_changed_cb()
215 typedef void (*tts_default_voice_changed_cb)(tts_h tts, const char* previous_language, int previous_voice_type,
216 const char* current_language, int current_voice_type, void* user_data);
218 * @brief Called when the engine is changed.
219 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
221 * @param[in] tts The TTS handle
222 * @param[in] engine_id Engine id
223 * @param[in] language The default language specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code (for example, "ko_KR" for Korean, "en_US" for American English)
224 * @param[in] voice_type The default voice type
225 * @param[in] need_credential The necessity of credential
226 * @param[in] user_data The user data passed from the callback registration function
228 * @see tts_set_engine_changed_cb()
230 typedef void (*tts_engine_changed_cb)(tts_h tts, const char* engine_id, const char* language, int voice_type, bool need_credential, void* user_data);
234 * @brief Creates a handle for TTS.
235 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
237 * @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
239 * @param[out] tts The TTS handle
241 * @return 0 on success, otherwise a negative error value
242 * @retval #TTS_ERROR_NONE Successful
243 * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
244 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
245 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
246 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
247 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
249 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
253 int tts_create(tts_h* tts);
256 * @brief Destroys the handle and disconnects the daemon.
257 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
259 * @param[in] tts The TTS handle
261 * @return 0 on success, otherwise a negative error value
262 * @retval #TTS_ERROR_NONE Successful
263 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
264 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
265 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
269 int tts_destroy(tts_h tts);
272 * @brief Sets the TTS mode.
273 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
275 * @param[in] tts The TTS handle
276 * @param[in] mode The mode
278 * @return 0 on success, otherwise a negative error value
279 * @retval #TTS_ERROR_NONE Successful
280 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
281 * @retval #TTS_ERROR_INVALID_STATE Invalid state
282 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
283 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
285 * @pre The state should be #TTS_STATE_CREATED.
287 * @see tts_get_mode()
289 int tts_set_mode(tts_h tts, tts_mode_e mode);
292 * @brief Gets the TTS mode.
293 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
295 * @param[in] tts The TTS handle
296 * @param[out] mode The mode
298 * @return 0 on success, otherwise a negative error value
299 * @retval #TTS_ERROR_NONE Successful
300 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
301 * @retval #TTS_ERROR_INVALID_STATE Invalid state
302 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
304 * @pre The state should be #TTS_STATE_CREATED.
306 * @see tts_set_mode()
308 int tts_get_mode(tts_h tts, tts_mode_e* mode);
311 * @brief Sets the app credential.
312 * @details Using this API, the application can set a credential.
313 * The credential is a key to verify the authorization about using the engine.
314 * If the application sets the credential, it will be able to use functions of the engine entirely.
315 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
317 * @remarks The necessity of the credential depends on the engine. In case of the engine which is basically embedded in Tizen, the credential is not necessary so far.
318 * However, if the user wants to apply the 3rd party's engine, the credential may be necessary. In that case, please follow the policy provided by the corresponding engine.
320 * @param[in] tts The TTS handle
321 * @param[in] credential The app credential
323 * @return 0 on success, otherwise a negative error value
324 * @retval #TTS_ERROR_NONE Success
325 * @retval #TTS_ERROR_INVALID_STATE Invalid state
326 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
327 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
329 * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
333 int tts_set_credential(tts_h tts, const char* credential);
336 * @brief Connects the daemon asynchronously.
337 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
339 * @param[in] tts The TTS handle
341 * @return 0 on success, otherwise a negative error value
342 * @retval #TTS_ERROR_NONE Successful
343 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #TTS_ERROR_INVALID_STATE Invalid state
345 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
347 * @pre The state should be #TTS_STATE_CREATED.
348 * @post If this function is successful, the TTS state will be #TTS_STATE_READY. \n
349 * If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
351 * @see tts_unprepare()
353 int tts_prepare(tts_h tts);
356 * @brief Disconnects the daemon.
357 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359 * @param[in] tts The TTS handle
361 * @return 0 on success, otherwise a negative error value
362 * @retval #TTS_ERROR_NONE Successful
363 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
364 * @retval #TTS_ERROR_INVALID_STATE Invalid state
365 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
367 * @pre The state should be #TTS_STATE_READY.
368 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
372 int tts_unprepare(tts_h tts);
375 * @brief Retrieves all supported voices of the current engine using callback function.
376 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
378 * @param[in] tts The TTS handle
379 * @param[in] callback The callback function to invoke
380 * @param[in] user_data The user data to be passed to the callback function
382 * @return 0 on success, otherwise a negative error value
383 * @retval #TTS_ERROR_NONE Successful
384 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
385 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
386 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
387 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
389 * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
391 * @see tts_get_default_voice()
393 int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data);
396 * @brief Gets the default voice set by the user.
397 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
399 * @remarks If the function succeeds, @a language must be released with free().
401 * @param[in] tts The TTS handle
402 * @param[out] language Language specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code (for example, "ko_KR" for Korean, "en_US" for American English)
403 * @param[out] voice_type The voice type
405 * @return 0 on success, otherwise a negative error value
406 * @retval #TTS_ERROR_NONE Successful
407 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
408 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
409 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
410 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
412 * @see tts_foreach_supported_voices()
414 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
417 * @brief Sets the private data to tts engine.
418 * @details The private data is the setting parameter for applying keys provided by the engine.
419 * Using this API, the application can set the private data and use the corresponding key of the engine.
420 * For example, if the engine provides 'girl's voice' as a voice type, the application can set the private data as the following. \n
421 * int ret = tts_set_private_data(tts_h, "voice_type", "GIRL");
423 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
425 * @remarks If the engine is replaced with the other engine, the key may be ignored.
427 * @param[in] tts The TTS handle
428 * @param[in] key The field name of private data
429 * @param[in] data The data for set
431 * @return 0 on success, otherwise a negative error value
432 * @retval #TTS_ERROR_NONE Successful
433 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
434 * @retval #TTS_ERROR_INVALID_STATE Invalid state
435 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
436 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
437 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
439 * @pre The state should be #TTS_STATE_READY.
441 * @see tts_get_private_data()
443 int tts_set_private_data(tts_h tts, const char* key, const char* data);
446 * @brief Gets the private data from tts engine.
447 * @details The private data is the information provided by the engine.
448 * Using this API, the application can get the private data which corresponds to the key from the engine.
449 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
451 * @remarks The @a data must be released using free() when it is no longer required.
452 * If the engine is replaced with the other engine, the key may be ignored.
454 * @param[in] tts The TTS handle
455 * @param[in] key The field name of private data
456 * @param[out] data The data field of private data
458 * @return 0 on success, otherwise a negative error value
459 * @retval #TTS_ERROR_NONE Successful
460 * @retval #TTS_ERROR_INVALID_STATE Invalid state
461 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
462 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
463 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
464 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
466 * @pre The state should be #TTS_STATE_READY.
468 * @see tts_set_private_data()
470 int tts_get_private_data(tts_h tts, const char* key, char** data);
473 * @brief Gets the maximum byte size for text.
474 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
476 * @param[in] tts The TTS handle
477 * @param[out] size The maximum byte size for text
479 * @return 0 on success, otherwise a negative error value
480 * @retval #TTS_ERROR_NONE Successful
481 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
482 * @retval #TTS_ERROR_INVALID_STATE Invalid state
483 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
485 * @pre The state should be #TTS_STATE_READY.
487 * @see tts_add_text()
489 int tts_get_max_text_size(tts_h tts, unsigned int* size);
492 * @brief Gets the current state of TTS.
493 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
495 * @param[in] tts The TTS handle
496 * @param[out] state The current state of TTS
498 * @return 0 on success, otherwise a negative error value
499 * @retval #TTS_ERROR_NONE Successful
500 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
501 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
507 int tts_get_state(tts_h tts, tts_state_e* state);
510 * @brief Gets the speed range.
511 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
513 * @param[in] tts The TTS handle
514 * @param[out] min The minimun speed value
515 * @param[out] normal The normal speed value
516 * @param[out] max The maximum speed value
518 * @return 0 on success, otherwise a negative error value
519 * @retval #TTS_ERROR_NONE Successful
520 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
521 * @retval #TTS_ERROR_INVALID_STATE Invalid state
522 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
523 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
525 * @pre The state should be #TTS_STATE_CREATED.
527 * @see tts_add_text()
529 int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
532 * @brief Gets the current error message.
533 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
535 * @remarks This function should be called from a tts error callback. Calling in any other context will result in an Operation failed error. \n
536 * A successful call will allocate @a err_msg, which must be released by calling free() when it is no longer required.
538 * @param[in] tts The TTS handle
539 * @param[out] err_msg The current error message
541 * @return 0 on success, otherwise a negative error value
542 * @retval #TTS_ERROR_NONE Successful
543 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
544 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
545 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
547 * @see tts_set_error_cb()
548 * @see tts_unset_error_cb()
550 int tts_get_error_message(tts_h tts, char** err_msg);
553 * @brief Adds a text to the queue.
554 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
556 * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check.
558 * @param[in] tts The TTS handle
559 * @param[in] text An input text based utf8
560 * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US')
561 * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE)
562 * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range())
563 * @param[out] utt_id The utterance ID passed to the callback function
565 * @return 0 on success, otherwise a negative error value
566 * @retval #TTS_ERROR_NONE Successful
567 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
568 * @retval #TTS_ERROR_INVALID_STATE Invalid state
569 * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
570 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
571 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
572 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
574 * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
575 * @see tts_get_max_text_size()
576 * @see tts_set_credential()
578 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id);
581 * @brief Starts synthesizing voice from the text and plays the synthesized audio data.
582 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
584 * @param[in] tts The TTS handle
586 * @return 0 on success, otherwise a negative error value
587 * @retval #TTS_ERROR_NONE Successful
588 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
589 * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
590 * @retval #TTS_ERROR_INVALID_STATE Invalid state
591 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
592 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
593 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
595 * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
596 * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
598 * @see tts_add_text()
601 * @see tts_utterance_started_cb()
602 * @see tts_utterance_completed_cb()
603 * @see tts_error_cb()
604 * @see tts_set_credential()
606 int tts_play(tts_h tts);
609 * @brief Stops playing the utterance and clears the queue.
610 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
612 * @param[in] tts The TTS handle
614 * @return 0 on success, otherwise a negative error value
615 * @retval #TTS_ERROR_NONE Successful
616 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
617 * @retval #TTS_ERROR_INVALID_STATE Invalid state
618 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
619 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
621 * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
622 * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
623 * This function will remove all text via tts_add_text() and synthesized sound data.
628 int tts_stop(tts_h tts);
631 * @brief Pauses the currently playing utterance.
632 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
634 * @param[in] tts The TTS handle
636 * @return 0 on success, otherwise a negative error value
637 * @retval #TTS_ERROR_NONE Successful
638 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
639 * @retval #TTS_ERROR_INVALID_STATE Invalid state
640 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
641 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
643 * @pre The TTS state should be #TTS_STATE_PLAYING.
644 * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
648 * @see tts_error_cb()
649 * @see tts_interrupted_cb()
651 int tts_pause(tts_h tts);
654 * @brief Registers a callback function to be called when the TTS state changes.
655 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
657 * @param[in] tts The TTS handle
658 * @param[in] callback The callback function to register
659 * @param[in] user_data The user data to be passed to the callback function
661 * @return 0 on success, otherwise a negative error value
662 * @retval #TTS_ERROR_NONE Successful
663 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
664 * @retval #TTS_ERROR_INVALID_STATE Invalid state
665 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
667 * @pre The state should be #TTS_STATE_CREATED.
669 * @see tts_state_changed_cb()
670 * @see tts_unset_state_changed_cb()
672 int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
675 * @brief Unregisters the callback function.
676 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
678 * @param[in] tts The TTS handle
680 * @return 0 on success, otherwise a negative error value
681 * @retval #TTS_ERROR_NONE Successful
682 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
683 * @retval #TTS_ERROR_INVALID_STATE Invalid state
684 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
686 * @pre The state should be #TTS_STATE_CREATED.
688 * @see tts_set_state_changed_cb()
690 int tts_unset_state_changed_cb(tts_h tts);
693 * @brief Registers a callback function to detect utterance start.
694 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
696 * @param[in] tts The TTS handle
697 * @param[in] callback The callback function to register
698 * @param[in] user_data The user data to be passed to the callback function
700 * @return 0 on success, otherwise a negative error value
701 * @retval #TTS_ERROR_NONE Successful
702 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
703 * @retval #TTS_ERROR_INVALID_STATE Invalid state
704 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
706 * @pre The state should be #TTS_STATE_CREATED.
708 * @see tts_utterance_started_cb()
709 * @see tts_unset_utterance_started_cb()
711 int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, void* user_data);
714 * @brief Unregisters the callback function.
715 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
717 * @param[in] tts The TTS handle
719 * @return 0 on success, otherwise a negative error value
720 * @retval #TTS_ERROR_NONE Successful
721 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
722 * @retval #TTS_ERROR_INVALID_STATE Invalid state
723 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
725 * @pre The state should be #TTS_STATE_CREATED.
727 * @see tts_set_utterance_started_cb()
729 int tts_unset_utterance_started_cb(tts_h tts);
732 * @brief Registers a callback function to detect utterance completion.
733 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
735 * @param[in] tts The TTS handle
736 * @param[in] callback The callback function to register
737 * @param[in] user_data The user data to be passed to the callback function
739 * @return 0 on success, otherwise a negative error value
740 * @retval #TTS_ERROR_NONE Successful
741 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
742 * @retval #TTS_ERROR_INVALID_STATE Invalid state
743 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
745 * @pre The state should be #TTS_STATE_CREATED.
747 * @see tts_utterance_completed_cb()
748 * @see tts_unset_utterance_completed_cb()
750 int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callback, void* user_data);
753 * @brief Unregisters the callback function.
754 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
756 * @param[in] tts The TTS handle
758 * @return 0 on success, otherwise a negative error value
759 * @retval #TTS_ERROR_NONE Successful
760 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
761 * @retval #TTS_ERROR_INVALID_STATE Invalid state
762 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
764 * @pre The state should be #TTS_STATE_CREATED.
766 * @see tts_set_utterance_completed_cb()
768 int tts_unset_utterance_completed_cb(tts_h tts);
771 * @brief Registers a callback function to detect errors.
772 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
774 * @param[in] tts The TTS handle
775 * @param[in] callback The callback function to register
776 * @param[in] user_data The user data to be passed to the callback function
778 * @return 0 on success, otherwise a negative error value
779 * @retval #TTS_ERROR_NONE Successful
780 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
781 * @retval #TTS_ERROR_INVALID_STATE Invalid state
782 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
784 * @pre The state should be #TTS_STATE_CREATED.
786 * @see tts_error_cb()
787 * @see tts_unset_error_cb()
789 int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
792 * @brief Unregisters the callback function.
793 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
795 * @param[in] tts The TTS handle
797 * @return 0 on success, otherwise a negative error value
798 * @retval #TTS_ERROR_NONE Successful
799 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
800 * @retval #TTS_ERROR_INVALID_STATE Invalid state
801 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
803 * @pre The state should be #TTS_STATE_CREATED.
805 * @see tts_set_error_cb()
807 int tts_unset_error_cb(tts_h tts);
810 * @brief Registers a callback function to detect default voice change.
811 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
813 * @param[in] tts The TTS handle
814 * @param[in] callback The callback function to register
815 * @param[in] user_data The user data to be passed to the callback function
817 * @return 0 on success, otherwise a negative error value
818 * @retval #TTS_ERROR_NONE Successful
819 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
820 * @retval #TTS_ERROR_INVALID_STATE Invalid state
821 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
823 * @pre The state should be #TTS_STATE_CREATED.
825 * @see tts_default_voice_changed_cb()
826 * @see tts_unset_default_voice_changed_cb()
828 int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb callback, void* user_data);
831 * @brief Unregisters the callback function.
832 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
834 * @param[in] tts The TTS handle
836 * @return 0 on success, otherwise a negative error value
837 * @retval #TTS_ERROR_NONE Successful
838 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
839 * @retval #TTS_ERROR_INVALID_STATE Invalid state
840 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
842 * @pre The state should be #TTS_STATE_CREATED.
844 * @see tts_set_default_voice_changed_cb()
846 int tts_unset_default_voice_changed_cb(tts_h tts);
849 * @brief Registers a callback function to detect the engine change.
850 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
852 * @param[in] tts The TTS handle
853 * @param]in] callback The callback function to register
854 * @param[in] user_data The user data to be passed to the callback function
856 * @return 0 on success, otherwise a negative error value
857 * @retval #TTS_ERROR_NONE Successful
858 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
859 * @retval #TTS_ERROR_INVALID_STATE Invalid state
860 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
862 * @pre The state should be #TTS_STATE_CREATED.
864 * @see tts_engine_changed_cb()
865 * @see tts_unset_engine_changed_cb()
867 int tts_set_engine_changed_cb(tts_h tts, tts_engine_changed_cb callback, void* user_data);
870 * @brief Unregisters the callback function.
871 * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
873 * @param[in] tts The TTS handle
875 * @return 0 on success, otherwise a negative error value
876 * @retval #TTS_ERROR_NONE Successful
877 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
878 * @retval #TTS_ERROR_INVALID_STATE Invalid state
879 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
881 * @pre The state should be #TTS_STATE_CREATED.
883 * @see tts_set_engine_changed_cb()
885 int tts_unset_engine_changed_cb(tts_h tts);
892 #endif /* __TTS_H__ */