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.
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 */
57 * @brief Enumeration for TTS mode.
58 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
61 TTS_MODE_DEFAULT = 0, /**< Default mode for normal application */
62 TTS_MODE_NOTIFICATION = 1, /**< Notification mode */
63 TTS_MODE_SCREEN_READER = 2 /**< Accessibiliity mode */
67 * @brief Enumerations for state.
68 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
71 TTS_STATE_CREATED = 0, /**< 'CREATED' state */
72 TTS_STATE_READY = 1, /**< 'READY' state */
73 TTS_STATE_PLAYING = 2, /**< 'PLAYING' state */
74 TTS_STATE_PAUSED = 3 /**< 'PAUSED' state*/
78 * @brief Definitions for automatic speaking speed.
79 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
81 #define TTS_SPEED_AUTO 0
84 * @brief Definitions for automatic voice type.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
87 #define TTS_VOICE_TYPE_AUTO 0
90 * @brief Definitions for male voice type.
91 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
93 #define TTS_VOICE_TYPE_MALE 1
96 * @brief Definitions for female voice type.
97 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
99 #define TTS_VOICE_TYPE_FEMALE 2
102 * @brief Definitions for child voice type.
103 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
105 #define TTS_VOICE_TYPE_CHILD 3
108 * @brief The TTS handle.
109 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
111 typedef struct tts_s *tts_h;
115 * @brief Called when the state of TTS is changed.
116 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
118 * @details If the daemon must stop player because of changing engine and
119 * the daemon must pause player because of other requests, this callback function is called.
121 * @param[in] tts The TTS handle
122 * @param[in] previous The previous state
123 * @param[in] current The current state
124 * @param[in] user_data The user data passed from the callback registration function
126 * @pre An application registers this callback using tts_set_state_changed_cb() to detect changing state.
128 * @see tts_set_state_changed_cb()
129 * @see tts_unset_state_changed_cb()
131 typedef void (*tts_state_changed_cb)(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data);
134 * @brief Called when utterance has started.
135 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
137 * @param[in] tts The TTS handle
138 * @param[in] utt_id The utterance ID passed from the add text function
139 * @param[in] user_data The user data passed from the callback registration function
141 * @pre An application registers this callback using tts_set_utterance_started_cb() to detect utterance started.
143 * @see tts_add_text()
144 * @see tts_set_utterance_started_cb()
145 * @see tts_unset_utterance_started_cb()
147 typedef void (*tts_utterance_started_cb)(tts_h tts, int utt_id, void* user_data);
150 * @brief Called when utterance is finished.
151 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
153 * @param[in] tts The TTS handle
154 * @param[in] utt_id The utterance ID passed from the add text function
155 * @param[in] user_data The user data passed from the callback registration function
157 * @pre An application registers this callback using tts_set_utterance_completed_cb() to detect utterance completed.
159 * @see tts_add_text()
160 * @see tts_set_utterance_completed_cb()
161 * @see tts_unset_utterance_completed_cb()
163 typedef void (*tts_utterance_completed_cb)(tts_h tts, int utt_id, void *user_data);
166 * @brief Called when an error occurs.
167 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
169 * @param[in] tts The TTS handle
170 * @param[in] utt_id The utterance ID passed from the add text function
171 * @param[in] reason The error code
172 * @param[in] user_data The user data passed from the callback registration function
174 * @pre An application registers this callback using tts_set_error_cb() to detect error.
179 * @see tts_set_error_cb()
180 * @see tts_unset_error_cb()
182 typedef void (*tts_error_cb)(tts_h tts, int utt_id, tts_error_e reason, void* user_data);
185 * @brief Called to retrieve the supported voice.
186 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
188 * @param[in] tts The TTS handle
189 * @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)
190 * @param[in] voice_type A voice type (e.g. #TTS_VOICE_TYPE_MALE, #TTS_VOICE_TYPE_FEMALE)
191 * @param[in] user_data The user data passed from the foreach function
193 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
194 * @pre tts_foreach_supported_voices() will invoke this callback function.
196 * @see tts_foreach_supported_voices()
198 typedef bool(*tts_supported_voice_cb)(tts_h tts, const char* language, int voice_type, void* user_data);
201 * @brief Called when the default voice is changed.
202 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
204 * @param[in] tts The TTS handle
205 * @param[in] previous_language The previous language
206 * @param[in] previous_voice_type The previous voice type
207 * @param[in] current_language The current language
208 * @param[in] current_voice_type The current voice type
209 * @param[in] user_data The user data passed from the callback registration function
211 * @see tts_set_default_voice_changed_cb()
213 typedef void (*tts_default_voice_changed_cb)(tts_h tts, const char* previous_language, int previous_voice_type,
214 const char* current_language, int current_voice_type, void* user_data);
218 * @brief Creates a handle for TTS.
219 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
221 * @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
223 * @param[out] tts The TTS handle
225 * @return 0 on success, otherwise a negative error value
226 * @retval #TTS_ERROR_NONE Successful
227 * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
228 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
230 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
231 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
233 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
237 int tts_create(tts_h* tts);
240 * @brief Destroys the handle and disconnects the daemon.
241 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
243 * @param[in] tts The TTS handle
245 * @return 0 on success, otherwise a negative error value
246 * @retval #TTS_ERROR_NONE Successful
247 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
248 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
249 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
253 int tts_destroy(tts_h tts);
256 * @brief Sets the TTS mode.
257 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
259 * @param[in] tts The TTS handle
260 * @param[in] mode The mode
262 * @return 0 on success, otherwise a negative error value
263 * @retval #TTS_ERROR_NONE Successful
264 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
265 * @retval #TTS_ERROR_INVALID_STATE Invalid state
266 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
267 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
269 * @pre The state should be #TTS_STATE_CREATED.
271 * @see tts_get_mode()
273 int tts_set_mode(tts_h tts, tts_mode_e mode);
276 * @brief Gets the TTS mode.
277 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
279 * @param[in] tts The TTS handle
280 * @param[out] mode The mode
282 * @return 0 on success, otherwise a negative error value
283 * @retval #TTS_ERROR_NONE Successful
284 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
285 * @retval #TTS_ERROR_INVALID_STATE Invalid state
286 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
288 * @pre The state should be #TTS_STATE_CREATED.
290 * @see tts_set_mode()
292 int tts_get_mode(tts_h tts, tts_mode_e* mode);
295 * @brief Sets the app credential.
299 * @param[in] tts The TTS handle
300 * @param[in] credential The app credential
302 * @return 0 on success, otherwise a negative error value
303 * @retval #TTS_ERROR_NONE Success
304 * @retval #TTS_ERROR_INVALID_STATE Invalid state
305 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
307 * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
311 int tts_set_credential(tts_h tts, const char* credential);
314 * @brief Connects the daemon asynchronously.
315 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
317 * @param[in] tts The TTS handle
319 * @return 0 on success, otherwise a negative error value
320 * @retval #TTS_ERROR_NONE Successful
321 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
322 * @retval #TTS_ERROR_INVALID_STATE Invalid state
323 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
325 * @pre The state should be #TTS_STATE_CREATED.
326 * @post If this function is successful, the TTS state will be #TTS_STATE_READY. \n
327 * If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
329 * @see tts_unprepare()
331 int tts_prepare(tts_h tts);
334 * @brief Disconnects the daemon.
335 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
337 * @param[in] tts The TTS handle
339 * @return 0 on success, otherwise a negative error value
340 * @retval #TTS_ERROR_NONE Successful
341 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
342 * @retval #TTS_ERROR_INVALID_STATE Invalid state
343 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
345 * @pre The state should be #TTS_STATE_READY.
346 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
350 int tts_unprepare(tts_h tts);
353 * @brief Retrieves all supported voices of the current engine using callback function.
354 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
356 * @param[in] tts The TTS handle
357 * @param[in] callback The callback function to invoke
358 * @param[in] user_data The user data to be passed to the callback function
360 * @return 0 on success, otherwise a negative error value
361 * @retval #TTS_ERROR_NONE Successful
362 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
363 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
364 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
365 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
367 * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
369 * @see tts_get_default_voice()
371 int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data);
374 * @brief Gets the default voice set by the user.
375 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
377 * @remarks If the function succeeds, @a language must be released with free().
379 * @param[in] tts The TTS handle
380 * @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)
381 * @param[out] voice_type The voice type
383 * @return 0 on success, otherwise a negative error value
384 * @retval #TTS_ERROR_NONE Successful
385 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
386 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
387 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
388 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
390 * @see tts_foreach_supported_voices()
392 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
395 * @brief Sets the private data to tts engine.
398 * @param[in] tts The TTS handle
399 * @param[in] key The field name of private data
400 * @param[in] data The data for set
402 * @return 0 on success, otherwise a negative error value
403 * @retval #TTS_ERROR_NONE Successful
404 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
405 * @retval #TTS_ERROR_INVALID_STATE Invalid state
406 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
407 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
408 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
410 * @pre The state should be #TTS_STATE_READY.
412 * @see tts_get_private_data()
414 int tts_set_private_data(tts_h tts, const char* key, const char* data);
417 * @brief Gets the private data from tts engine.
420 * @param[in] tts The TTS handle
421 * @param[in] key The field name of private data
422 * @param[out] data The data
424 * @return 0 on success, otherwise a negative error value
425 * @retval #TTS_ERROR_NONE Successful
426 * @retval #TTS_ERROR_INVALID_STATE Invalid state
427 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
428 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
429 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
430 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
432 * @pre The state should be #TTS_STATE_READY.
434 * @see tts_set_private_data()
436 int tts_get_private_data(tts_h tts, const char* key, char** data);
439 * @brief Gets the maximum byte size for text.
440 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
442 * @param[in] tts The TTS handle
443 * @param[out] size The maximum byte size for text
445 * @return 0 on success, otherwise a negative error value
446 * @retval #TTS_ERROR_NONE Successful
447 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
448 * @retval #TTS_ERROR_INVALID_STATE Invalid state
449 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
451 * @pre The state should be #TTS_STATE_READY.
453 * @see tts_add_text()
455 int tts_get_max_text_size(tts_h tts, unsigned int* size);
458 * @brief Gets the current state of TTS.
459 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
461 * @param[in] tts The TTS handle
462 * @param[out] state The current state of TTS
464 * @return 0 on success, otherwise a negative error value
465 * @retval #TTS_ERROR_NONE Successful
466 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
467 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
473 int tts_get_state(tts_h tts, tts_state_e* state);
476 * @brief Gets the speed range.
477 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
479 * @param[in] tts The TTS handle
480 * @param[out] min The minimun speed value
481 * @param[out] normal The normal speed value
482 * @param[out] max The maximum speed value
484 * @return 0 on success, otherwise a negative error value
485 * @retval #TTS_ERROR_NONE Successful
486 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
487 * @retval #TTS_ERROR_INVALID_STATE Invalid state
488 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
489 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
491 * @pre The state should be #TTS_STATE_CREATED.
493 * @see tts_add_text()
495 int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
498 * @brief Gets the current error message.
501 * @remarks This function should be called during an tts error callback. If not, the error as operation failure will be returned. \n
502 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
504 * @param[in] tts The TTS handle
505 * @param[out] err_msg The current error message
507 * @return 0 on success, otherwise a negative error value
508 * @retval #TTS_ERROR_NONE Successful
509 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
510 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
511 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
513 * @see tts_set_error_cb()
514 * @see tts_unset_error_cb()
516 int tts_get_error_message(tts_h tts, char** err_msg);
519 * @brief Adds a text to the queue.
520 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
522 * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check.
524 * @param[in] tts The TTS handle
525 * @param[in] text An input text based utf8
526 * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US')
527 * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE)
528 * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range())
529 * @param[out] utt_id The utterance ID passed to the callback function
531 * @return 0 on success, otherwise a negative error value
532 * @retval #TTS_ERROR_NONE Successful
533 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
534 * @retval #TTS_ERROR_INVALID_STATE Invalid state
535 * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
536 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
537 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
538 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
540 * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
541 * @see tts_get_max_text_size()
542 * @see tts_set_credential()
544 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id);
547 * @brief Starts synthesizing voice from the text and plays the synthesized audio data.
548 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
550 * @param[in] tts The TTS handle
552 * @return 0 on success, otherwise a negative error value
553 * @retval #TTS_ERROR_NONE Successful
554 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
555 * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
556 * @retval #TTS_ERROR_INVALID_STATE Invalid state
557 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
558 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
559 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
561 * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
562 * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
564 * @see tts_add_text()
567 * @see tts_utterance_started_cb()
568 * @see tts_utterance_completed_cb()
569 * @see tts_error_cb()
570 * @see tts_set_credential()
572 int tts_play(tts_h tts);
575 * @brief Stops playing the utterance and clears the queue.
576 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
578 * @param[in] tts The TTS handle
580 * @return 0 on success, otherwise a negative error value
581 * @retval #TTS_ERROR_NONE Successful
582 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
583 * @retval #TTS_ERROR_INVALID_STATE Invalid state
584 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
585 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
587 * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
588 * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
589 * This function will remove all text via tts_add_text() and synthesized sound data.
594 int tts_stop(tts_h tts);
597 * @brief Pauses the currently playing utterance.
598 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
600 * @param[in] tts The TTS handle
602 * @return 0 on success, otherwise a negative error value
603 * @retval #TTS_ERROR_NONE Successful
604 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
605 * @retval #TTS_ERROR_INVALID_STATE Invalid state
606 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
607 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
609 * @pre The TTS state should be #TTS_STATE_PLAYING.
610 * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
614 * @see tts_error_cb()
615 * @see tts_interrupted_cb()
617 int tts_pause(tts_h tts);
620 * @brief Registers a callback function to be called when the TTS state changes.
621 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
623 * @param[in] tts The TTS handle
624 * @param[in] callback The callback function to register
625 * @param[in] user_data The user data to be passed to the callback function
627 * @return 0 on success, otherwise a negative error value
628 * @retval #TTS_ERROR_NONE Successful
629 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
630 * @retval #TTS_ERROR_INVALID_STATE Invalid state
631 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
633 * @pre The state should be #TTS_STATE_CREATED.
635 * @see tts_state_changed_cb()
636 * @see tts_unset_state_changed_cb()
638 int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
641 * @brief Unregisters the callback function.
642 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
644 * @param[in] tts The TTS handle
646 * @return 0 on success, otherwise a negative error value
647 * @retval #TTS_ERROR_NONE Successful
648 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
649 * @retval #TTS_ERROR_INVALID_STATE Invalid state
650 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
652 * @pre The state should be #TTS_STATE_CREATED.
654 * @see tts_set_state_changed_cb()
656 int tts_unset_state_changed_cb(tts_h tts);
659 * @brief Registers a callback function to detect utterance start.
660 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
662 * @param[in] tts The TTS handle
663 * @param[in] callback The callback function to register
664 * @param[in] user_data The user data to be passed to the callback function
666 * @return 0 on success, otherwise a negative error value
667 * @retval #TTS_ERROR_NONE Successful
668 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
669 * @retval #TTS_ERROR_INVALID_STATE Invalid state
670 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
672 * @pre The state should be #TTS_STATE_CREATED.
674 * @see tts_utterance_started_cb()
675 * @see tts_unset_utterance_started_cb()
677 int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, void* user_data);
680 * @brief Unregisters the callback function.
681 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
683 * @param[in] tts The TTS handle
685 * @return 0 on success, otherwise a negative error value
686 * @retval #TTS_ERROR_NONE Successful
687 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
688 * @retval #TTS_ERROR_INVALID_STATE Invalid state
689 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
691 * @pre The state should be #TTS_STATE_CREATED.
693 * @see tts_set_utterance_started_cb()
695 int tts_unset_utterance_started_cb(tts_h tts);
698 * @brief Registers a callback function to detect utterance completion.
699 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
701 * @param[in] tts The TTS handle
702 * @param[in] callback The callback function to register
703 * @param[in] user_data The user data to be passed to the callback function
705 * @return 0 on success, otherwise a negative error value
706 * @retval #TTS_ERROR_NONE Successful
707 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
708 * @retval #TTS_ERROR_INVALID_STATE Invalid state
709 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
711 * @pre The state should be #TTS_STATE_CREATED.
713 * @see tts_utterance_completed_cb()
714 * @see tts_unset_utterance_completed_cb()
716 int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callback, void* user_data);
719 * @brief Unregisters the callback function.
720 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
722 * @param[in] tts The TTS handle
724 * @return 0 on success, otherwise a negative error value
725 * @retval #TTS_ERROR_NONE Successful
726 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
727 * @retval #TTS_ERROR_INVALID_STATE Invalid state
728 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
730 * @pre The state should be #TTS_STATE_CREATED.
732 * @see tts_set_utterance_completed_cb()
734 int tts_unset_utterance_completed_cb(tts_h tts);
737 * @brief Registers a callback function to detect errors.
738 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
740 * @param[in] tts The TTS handle
741 * @param[in] callback The callback function to register
742 * @param[in] user_data The user data to be passed to the callback function
744 * @return 0 on success, otherwise a negative error value
745 * @retval #TTS_ERROR_NONE Successful
746 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
747 * @retval #TTS_ERROR_INVALID_STATE Invalid state
748 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
750 * @pre The state should be #TTS_STATE_CREATED.
752 * @see tts_error_cb()
753 * @see tts_unset_error_cb()
755 int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
758 * @brief Unregisters the callback function.
759 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
761 * @param[in] tts The TTS handle
763 * @return 0 on success, otherwise a negative error value
764 * @retval #TTS_ERROR_NONE Successful
765 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
766 * @retval #TTS_ERROR_INVALID_STATE Invalid state
767 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
769 * @pre The state should be #TTS_STATE_CREATED.
771 * @see tts_set_error_cb()
773 int tts_unset_error_cb(tts_h tts);
776 * @brief Registers a callback function to detect default voice change.
777 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
779 * @param[in] tts The TTS handle
780 * @param[in] callback The callback function to register
781 * @param[in] user_data The user data to be passed to the callback function
783 * @return 0 on success, otherwise a negative error value
784 * @retval #TTS_ERROR_NONE Successful
785 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
786 * @retval #TTS_ERROR_INVALID_STATE Invalid state
787 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
789 * @pre The state should be #TTS_STATE_CREATED.
791 * @see tts_default_voice_changed_cb()
792 * @see tts_unset_default_voice_changed_cb()
794 int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb callback, void* user_data);
797 * @brief Unregisters the callback function.
798 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
800 * @param[in] tts The TTS handle
802 * @return 0 on success, otherwise a negative error value
803 * @retval #TTS_ERROR_NONE Successful
804 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
805 * @retval #TTS_ERROR_INVALID_STATE Invalid state
806 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
808 * @pre The state should be #TTS_STATE_CREATED.
810 * @see tts_set_default_voice_changed_cb()
812 int tts_unset_default_voice_changed_cb(tts_h tts);
823 #endif /* __TTS_H__ */