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*/
58 * @brief Enumeration for TTS mode.
59 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
62 TTS_MODE_DEFAULT = 0, /**< Default mode for normal application */
63 TTS_MODE_NOTIFICATION = 1, /**< Notification mode */
64 TTS_MODE_SCREEN_READER = 2 /**< Accessibiliity mode */
68 * @brief Enumerations for state.
69 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72 TTS_STATE_CREATED = 0, /**< 'CREATED' state */
73 TTS_STATE_READY = 1, /**< 'READY' state */
74 TTS_STATE_PLAYING = 2, /**< 'PLAYING' state */
75 TTS_STATE_PAUSED = 3 /**< 'PAUSED' state*/
79 * @brief Definitions for automatic speaking speed.
80 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
82 #define TTS_SPEED_AUTO 0
85 * @brief Definitions for automatic voice type.
86 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
88 #define TTS_VOICE_TYPE_AUTO 0
91 * @brief Definitions for male voice type.
92 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
94 #define TTS_VOICE_TYPE_MALE 1
97 * @brief Definitions for female voice type.
98 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
100 #define TTS_VOICE_TYPE_FEMALE 2
103 * @brief Definitions for child voice type.
104 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
106 #define TTS_VOICE_TYPE_CHILD 3
109 * @brief The TTS handle.
110 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
112 typedef struct tts_s *tts_h;
116 * @brief Called when the state of TTS is changed.
117 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
119 * @details If the daemon must stop player because of changing engine and
120 * the daemon must pause player because of other requests, this callback function is called.
122 * @param[in] tts The TTS handle
123 * @param[in] previous The previous state
124 * @param[in] current The current state
125 * @param[in] user_data The user data passed from the callback registration function
127 * @pre An application registers this callback using tts_set_state_changed_cb() to detect changing state.
129 * @see tts_set_state_changed_cb()
130 * @see tts_unset_state_changed_cb()
132 typedef void (*tts_state_changed_cb)(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data);
135 * @brief Called when utterance has started.
136 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
138 * @param[in] tts The TTS handle
139 * @param[in] utt_id The utterance ID passed from the add text function
140 * @param[in] user_data The user data passed from the callback registration function
142 * @pre An application registers this callback using tts_set_utterance_started_cb() to detect utterance started.
144 * @see tts_add_text()
145 * @see tts_set_utterance_started_cb()
146 * @see tts_unset_utterance_started_cb()
148 typedef void (*tts_utterance_started_cb)(tts_h tts, int utt_id, void* user_data);
151 * @brief Called when utterance is finished.
152 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154 * @param[in] tts The TTS handle
155 * @param[in] utt_id The utterance ID passed from the add text function
156 * @param[in] user_data The user data passed from the callback registration function
158 * @pre An application registers this callback using tts_set_utterance_completed_cb() to detect utterance completed.
160 * @see tts_add_text()
161 * @see tts_set_utterance_completed_cb()
162 * @see tts_unset_utterance_completed_cb()
164 typedef void (*tts_utterance_completed_cb)(tts_h tts, int utt_id, void *user_data);
167 * @brief Called when an error occurs.
168 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
170 * @param[in] tts The TTS handle
171 * @param[in] utt_id The utterance ID passed from the add text function
172 * @param[in] reason The error code
173 * @param[in] user_data The user data passed from the callback registration function
175 * @pre An application registers this callback using tts_set_error_cb() to detect error.
180 * @see tts_set_error_cb()
181 * @see tts_unset_error_cb()
183 typedef void (*tts_error_cb)(tts_h tts, int utt_id, tts_error_e reason, void* user_data);
186 * @brief Called to retrieve the supported voice.
187 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
189 * @param[in] tts The TTS handle
190 * @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)
191 * @param[in] voice_type A voice type (e.g. #TTS_VOICE_TYPE_MALE, #TTS_VOICE_TYPE_FEMALE)
192 * @param[in] user_data The user data passed from the foreach function
194 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
195 * @pre tts_foreach_supported_voices() will invoke this callback function.
197 * @see tts_foreach_supported_voices()
199 typedef bool(*tts_supported_voice_cb)(tts_h tts, const char* language, int voice_type, void* user_data);
202 * @brief Called when the default voice is changed.
203 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
205 * @param[in] tts The TTS handle
206 * @param[in] previous_language The previous language
207 * @param[in] previous_voice_type The previous voice type
208 * @param[in] current_language The current language
209 * @param[in] current_voice_type The current voice type
210 * @param[in] user_data The user data passed from the callback registration function
212 * @see tts_set_default_voice_changed_cb()
214 typedef void (*tts_default_voice_changed_cb)(tts_h tts, const char* previous_language, int previous_voice_type,
215 const char* current_language, int current_voice_type, void* user_data);
219 * @brief Creates a handle for TTS.
220 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
222 * @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
224 * @param[out] tts The TTS handle
226 * @return 0 on success, otherwise a negative error value
227 * @retval #TTS_ERROR_NONE Successful
228 * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
229 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
230 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
231 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
232 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
234 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
238 int tts_create(tts_h* tts);
241 * @brief Destroys the handle and disconnects the daemon.
242 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
244 * @param[in] tts The TTS handle
246 * @return 0 on success, otherwise a negative error value
247 * @retval #TTS_ERROR_NONE Successful
248 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
249 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
250 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
254 int tts_destroy(tts_h tts);
257 * @brief Sets the TTS mode.
258 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
260 * @param[in] tts The TTS handle
261 * @param[in] mode The mode
263 * @return 0 on success, otherwise a negative error value
264 * @retval #TTS_ERROR_NONE Successful
265 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
266 * @retval #TTS_ERROR_INVALID_STATE Invalid state
267 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
268 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
270 * @pre The state should be #TTS_STATE_CREATED.
272 * @see tts_get_mode()
274 int tts_set_mode(tts_h tts, tts_mode_e mode);
277 * @brief Gets the TTS mode.
278 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
280 * @param[in] tts The TTS handle
281 * @param[out] mode The mode
283 * @return 0 on success, otherwise a negative error value
284 * @retval #TTS_ERROR_NONE Successful
285 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
286 * @retval #TTS_ERROR_INVALID_STATE Invalid state
287 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
289 * @pre The state should be #TTS_STATE_CREATED.
291 * @see tts_set_mode()
293 int tts_get_mode(tts_h tts, tts_mode_e* mode);
296 * @brief Sets the app credential.
300 * @param[in] tts The TTS handle
301 * @param[in] credential The app credential
303 * @return 0 on success, otherwise a negative error value
304 * @retval #TTS_ERROR_NONE Success
305 * @retval #TTS_ERROR_INVALID_STATE Invalid state
306 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
308 * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
312 int tts_set_credential(tts_h tts, const char* credential);
315 * @brief Connects the daemon asynchronously.
316 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318 * @param[in] tts The TTS handle
320 * @return 0 on success, otherwise a negative error value
321 * @retval #TTS_ERROR_NONE Successful
322 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
323 * @retval #TTS_ERROR_INVALID_STATE Invalid state
324 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
326 * @pre The state should be #TTS_STATE_CREATED.
327 * @post If this function is successful, the TTS state will be #TTS_STATE_READY. \n
328 * If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
330 * @see tts_unprepare()
332 int tts_prepare(tts_h tts);
335 * @brief Disconnects the daemon.
336 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
338 * @param[in] tts The TTS handle
340 * @return 0 on success, otherwise a negative error value
341 * @retval #TTS_ERROR_NONE Successful
342 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
343 * @retval #TTS_ERROR_INVALID_STATE Invalid state
344 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
346 * @pre The state should be #TTS_STATE_READY.
347 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
351 int tts_unprepare(tts_h tts);
354 * @brief Retrieves all supported voices of the current engine using callback function.
355 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
357 * @param[in] tts The TTS handle
358 * @param[in] callback The callback function to invoke
359 * @param[in] user_data The user data to be passed to the callback function
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_ENGINE_NOT_FOUND Engine not found
365 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
366 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
368 * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
370 * @see tts_get_default_voice()
372 int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data);
375 * @brief Gets the default voice set by the user.
376 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
378 * @remarks If the function succeeds, @a language must be released with free().
380 * @param[in] tts The TTS handle
381 * @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)
382 * @param[out] voice_type The voice type
384 * @return 0 on success, otherwise a negative error value
385 * @retval #TTS_ERROR_NONE Successful
386 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
387 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
388 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
389 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
391 * @see tts_foreach_supported_voices()
393 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
396 * @brief Sets the private data to tts engine.
399 * @param[in] tts The TTS handle
400 * @param[in] key The field name of private data
401 * @param[in] data The data for set
403 * @return 0 on success, otherwise a negative error value
404 * @retval #TTS_ERROR_NONE Successful
405 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
406 * @retval #TTS_ERROR_INVALID_STATE Invalid state
407 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
408 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
409 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
411 * @pre The state should be #TTS_STATE_READY.
413 * @see tts_get_private_data()
415 int tts_set_private_data(tts_h tts, const char* key, const char* data);
418 * @brief Gets the private data from tts engine.
421 * @remarks data must be released using free() when it is no longer required.
423 * @param[in] tts The TTS handle
424 * @param[in] key The field name of private data
425 * @param[out] data The data
427 * @return 0 on success, otherwise a negative error value
428 * @retval #TTS_ERROR_NONE Successful
429 * @retval #TTS_ERROR_INVALID_STATE Invalid state
430 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
431 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
432 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
433 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
435 * @pre The state should be #TTS_STATE_READY.
437 * @see tts_set_private_data()
439 int tts_get_private_data(tts_h tts, const char* key, char** data);
442 * @brief Gets the maximum byte size for text.
443 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
445 * @param[in] tts The TTS handle
446 * @param[out] size The maximum byte size for text
448 * @return 0 on success, otherwise a negative error value
449 * @retval #TTS_ERROR_NONE Successful
450 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
451 * @retval #TTS_ERROR_INVALID_STATE Invalid state
452 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
454 * @pre The state should be #TTS_STATE_READY.
456 * @see tts_add_text()
458 int tts_get_max_text_size(tts_h tts, unsigned int* size);
461 * @brief Gets the current state of TTS.
462 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
464 * @param[in] tts The TTS handle
465 * @param[out] state The current state of TTS
467 * @return 0 on success, otherwise a negative error value
468 * @retval #TTS_ERROR_NONE Successful
469 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
470 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
476 int tts_get_state(tts_h tts, tts_state_e* state);
479 * @brief Gets the speed range.
480 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
482 * @param[in] tts The TTS handle
483 * @param[out] min The minimun speed value
484 * @param[out] normal The normal speed value
485 * @param[out] max The maximum speed value
487 * @return 0 on success, otherwise a negative error value
488 * @retval #TTS_ERROR_NONE Successful
489 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
490 * @retval #TTS_ERROR_INVALID_STATE Invalid state
491 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
492 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
494 * @pre The state should be #TTS_STATE_CREATED.
496 * @see tts_add_text()
498 int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
501 * @brief Gets the current error message.
504 * @remarks This function should be called during an tts error callback. If not, the error as operation failure will be returned. \n
505 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
507 * @param[in] tts The TTS handle
508 * @param[out] err_msg The current error message
510 * @return 0 on success, otherwise a negative error value
511 * @retval #TTS_ERROR_NONE Successful
512 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
513 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
514 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
516 * @see tts_set_error_cb()
517 * @see tts_unset_error_cb()
519 int tts_get_error_message(tts_h tts, char** err_msg);
522 * @brief Adds a text to the queue.
523 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
525 * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check.
527 * @param[in] tts The TTS handle
528 * @param[in] text An input text based utf8
529 * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US')
530 * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE)
531 * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range())
532 * @param[out] utt_id The utterance ID passed to the callback function
534 * @return 0 on success, otherwise a negative error value
535 * @retval #TTS_ERROR_NONE Successful
536 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
537 * @retval #TTS_ERROR_INVALID_STATE Invalid state
538 * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
539 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
540 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
541 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
543 * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
544 * @see tts_get_max_text_size()
545 * @see tts_set_credential()
547 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id);
550 * @brief Starts synthesizing voice from the text and plays the synthesized audio data.
551 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553 * @param[in] tts The TTS handle
555 * @return 0 on success, otherwise a negative error value
556 * @retval #TTS_ERROR_NONE Successful
557 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
558 * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
559 * @retval #TTS_ERROR_INVALID_STATE Invalid state
560 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
561 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
562 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
564 * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
565 * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
567 * @see tts_add_text()
570 * @see tts_utterance_started_cb()
571 * @see tts_utterance_completed_cb()
572 * @see tts_error_cb()
573 * @see tts_set_credential()
575 int tts_play(tts_h tts);
578 * @brief Stops playing the utterance and clears the queue.
579 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
581 * @param[in] tts The TTS handle
583 * @return 0 on success, otherwise a negative error value
584 * @retval #TTS_ERROR_NONE Successful
585 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
586 * @retval #TTS_ERROR_INVALID_STATE Invalid state
587 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
588 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
590 * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
591 * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
592 * This function will remove all text via tts_add_text() and synthesized sound data.
597 int tts_stop(tts_h tts);
600 * @brief Pauses the currently playing utterance.
601 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
603 * @param[in] tts The TTS handle
605 * @return 0 on success, otherwise a negative error value
606 * @retval #TTS_ERROR_NONE Successful
607 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
608 * @retval #TTS_ERROR_INVALID_STATE Invalid state
609 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
610 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
612 * @pre The TTS state should be #TTS_STATE_PLAYING.
613 * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
617 * @see tts_error_cb()
618 * @see tts_interrupted_cb()
620 int tts_pause(tts_h tts);
623 * @brief Registers a callback function to be called when the TTS state changes.
624 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
626 * @param[in] tts The TTS handle
627 * @param[in] callback The callback function to register
628 * @param[in] user_data The user data to be passed to the callback function
630 * @return 0 on success, otherwise a negative error value
631 * @retval #TTS_ERROR_NONE Successful
632 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
633 * @retval #TTS_ERROR_INVALID_STATE Invalid state
634 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
636 * @pre The state should be #TTS_STATE_CREATED.
638 * @see tts_state_changed_cb()
639 * @see tts_unset_state_changed_cb()
641 int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
644 * @brief Unregisters the callback function.
645 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
647 * @param[in] tts The TTS handle
649 * @return 0 on success, otherwise a negative error value
650 * @retval #TTS_ERROR_NONE Successful
651 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
652 * @retval #TTS_ERROR_INVALID_STATE Invalid state
653 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
655 * @pre The state should be #TTS_STATE_CREATED.
657 * @see tts_set_state_changed_cb()
659 int tts_unset_state_changed_cb(tts_h tts);
662 * @brief Registers a callback function to detect utterance start.
663 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
665 * @param[in] tts The TTS handle
666 * @param[in] callback The callback function to register
667 * @param[in] user_data The user data to be passed to the callback function
669 * @return 0 on success, otherwise a negative error value
670 * @retval #TTS_ERROR_NONE Successful
671 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
672 * @retval #TTS_ERROR_INVALID_STATE Invalid state
673 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
675 * @pre The state should be #TTS_STATE_CREATED.
677 * @see tts_utterance_started_cb()
678 * @see tts_unset_utterance_started_cb()
680 int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, void* user_data);
683 * @brief Unregisters the callback function.
684 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
686 * @param[in] tts The TTS handle
688 * @return 0 on success, otherwise a negative error value
689 * @retval #TTS_ERROR_NONE Successful
690 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
691 * @retval #TTS_ERROR_INVALID_STATE Invalid state
692 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
694 * @pre The state should be #TTS_STATE_CREATED.
696 * @see tts_set_utterance_started_cb()
698 int tts_unset_utterance_started_cb(tts_h tts);
701 * @brief Registers a callback function to detect utterance completion.
702 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704 * @param[in] tts The TTS handle
705 * @param[in] callback The callback function to register
706 * @param[in] user_data The user data to be passed to the callback function
708 * @return 0 on success, otherwise a negative error value
709 * @retval #TTS_ERROR_NONE Successful
710 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
711 * @retval #TTS_ERROR_INVALID_STATE Invalid state
712 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
714 * @pre The state should be #TTS_STATE_CREATED.
716 * @see tts_utterance_completed_cb()
717 * @see tts_unset_utterance_completed_cb()
719 int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callback, void* user_data);
722 * @brief Unregisters the callback function.
723 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
725 * @param[in] tts The TTS handle
727 * @return 0 on success, otherwise a negative error value
728 * @retval #TTS_ERROR_NONE Successful
729 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
730 * @retval #TTS_ERROR_INVALID_STATE Invalid state
731 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
733 * @pre The state should be #TTS_STATE_CREATED.
735 * @see tts_set_utterance_completed_cb()
737 int tts_unset_utterance_completed_cb(tts_h tts);
740 * @brief Registers a callback function to detect errors.
741 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
743 * @param[in] tts The TTS handle
744 * @param[in] callback The callback function to register
745 * @param[in] user_data The user data to be passed to the callback function
747 * @return 0 on success, otherwise a negative error value
748 * @retval #TTS_ERROR_NONE Successful
749 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
750 * @retval #TTS_ERROR_INVALID_STATE Invalid state
751 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
753 * @pre The state should be #TTS_STATE_CREATED.
755 * @see tts_error_cb()
756 * @see tts_unset_error_cb()
758 int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
761 * @brief Unregisters the callback function.
762 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
764 * @param[in] tts The TTS handle
766 * @return 0 on success, otherwise a negative error value
767 * @retval #TTS_ERROR_NONE Successful
768 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
769 * @retval #TTS_ERROR_INVALID_STATE Invalid state
770 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
772 * @pre The state should be #TTS_STATE_CREATED.
774 * @see tts_set_error_cb()
776 int tts_unset_error_cb(tts_h tts);
779 * @brief Registers a callback function to detect default voice change.
780 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
782 * @param[in] tts The TTS handle
783 * @param[in] callback The callback function to register
784 * @param[in] user_data The user data to be passed to the callback function
786 * @return 0 on success, otherwise a negative error value
787 * @retval #TTS_ERROR_NONE Successful
788 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
789 * @retval #TTS_ERROR_INVALID_STATE Invalid state
790 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
792 * @pre The state should be #TTS_STATE_CREATED.
794 * @see tts_default_voice_changed_cb()
795 * @see tts_unset_default_voice_changed_cb()
797 int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb callback, void* user_data);
800 * @brief Unregisters the callback function.
801 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
803 * @param[in] tts The TTS handle
805 * @return 0 on success, otherwise a negative error value
806 * @retval #TTS_ERROR_NONE Successful
807 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
808 * @retval #TTS_ERROR_INVALID_STATE Invalid state
809 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
811 * @pre The state should be #TTS_STATE_CREATED.
813 * @see tts_set_default_voice_changed_cb()
815 int tts_unset_default_voice_changed_cb(tts_h tts);
826 #endif /* __TTS_H__ */