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*/
55 TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07 /**< Service reset */
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);
220 * @brief Creates a handle for TTS.
221 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
223 * @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
225 * @param[out] tts The TTS handle
227 * @return 0 on success, otherwise a negative error value
228 * @retval #TTS_ERROR_NONE Successful
229 * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
230 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
231 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
232 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
233 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
235 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
239 int tts_create(tts_h* tts);
242 * @brief Destroys the handle and disconnects the daemon.
243 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
245 * @param[in] tts The TTS handle
247 * @return 0 on success, otherwise a negative error value
248 * @retval #TTS_ERROR_NONE Successful
249 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
250 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
251 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
255 int tts_destroy(tts_h tts);
258 * @brief Sets the TTS mode.
259 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
261 * @param[in] tts The TTS handle
262 * @param[in] mode The mode
264 * @return 0 on success, otherwise a negative error value
265 * @retval #TTS_ERROR_NONE Successful
266 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
267 * @retval #TTS_ERROR_INVALID_STATE Invalid state
268 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
269 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
271 * @pre The state should be #TTS_STATE_CREATED.
273 * @see tts_get_mode()
275 int tts_set_mode(tts_h tts, tts_mode_e mode);
278 * @brief Gets the TTS mode.
279 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
281 * @param[in] tts The TTS handle
282 * @param[out] mode The mode
284 * @return 0 on success, otherwise a negative error value
285 * @retval #TTS_ERROR_NONE Successful
286 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
287 * @retval #TTS_ERROR_INVALID_STATE Invalid state
288 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
290 * @pre The state should be #TTS_STATE_CREATED.
292 * @see tts_set_mode()
294 int tts_get_mode(tts_h tts, tts_mode_e* mode);
297 * @brief Sets the app credential.
301 * @param[in] tts The TTS handle
302 * @param[in] credential The app credential
304 * @return 0 on success, otherwise a negative error value
305 * @retval #TTS_ERROR_NONE Success
306 * @retval #TTS_ERROR_INVALID_STATE Invalid state
307 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
309 * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
313 int tts_set_credential(tts_h tts, const char* credential);
316 * @brief Connects the daemon asynchronously.
317 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
319 * @param[in] tts The TTS handle
321 * @return 0 on success, otherwise a negative error value
322 * @retval #TTS_ERROR_NONE Successful
323 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
324 * @retval #TTS_ERROR_INVALID_STATE Invalid state
325 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
327 * @pre The state should be #TTS_STATE_CREATED.
328 * @post If this function is successful, the TTS state will be #TTS_STATE_READY. \n
329 * If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
331 * @see tts_unprepare()
333 int tts_prepare(tts_h tts);
336 * @brief Disconnects the daemon.
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_READY.
348 * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
352 int tts_unprepare(tts_h tts);
355 * @brief Retrieves all supported voices of the current engine using callback function.
356 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
358 * @param[in] tts The TTS handle
359 * @param[in] callback The callback function to invoke
360 * @param[in] user_data The user data to be passed to the callback function
362 * @return 0 on success, otherwise a negative error value
363 * @retval #TTS_ERROR_NONE Successful
364 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
365 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
366 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
367 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
369 * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
371 * @see tts_get_default_voice()
373 int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data);
376 * @brief Gets the default voice set by the user.
377 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
379 * @remarks If the function succeeds, @a language must be released with free().
381 * @param[in] tts The TTS handle
382 * @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)
383 * @param[out] voice_type The voice type
385 * @return 0 on success, otherwise a negative error value
386 * @retval #TTS_ERROR_NONE Successful
387 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
388 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
389 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
390 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
392 * @see tts_foreach_supported_voices()
394 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
397 * @brief Sets the private data to tts engine.
400 * @param[in] tts The TTS handle
401 * @param[in] key The field name of private data
402 * @param[in] data The data for set
404 * @return 0 on success, otherwise a negative error value
405 * @retval #TTS_ERROR_NONE Successful
406 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
407 * @retval #TTS_ERROR_INVALID_STATE Invalid state
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 * @pre The state should be #TTS_STATE_READY.
414 * @see tts_get_private_data()
416 int tts_set_private_data(tts_h tts, const char* key, const char* data);
419 * @brief Gets the private data from tts engine.
422 * @remarks data must be released using free() when it is no longer required.
424 * @param[in] tts The TTS handle
425 * @param[in] key The field name of private data
426 * @param[out] data The data
428 * @return 0 on success, otherwise a negative error value
429 * @retval #TTS_ERROR_NONE Successful
430 * @retval #TTS_ERROR_INVALID_STATE Invalid state
431 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
432 * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
433 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
434 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
436 * @pre The state should be #TTS_STATE_READY.
438 * @see tts_set_private_data()
440 int tts_get_private_data(tts_h tts, const char* key, char** data);
443 * @brief Gets the maximum byte size for text.
444 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
446 * @param[in] tts The TTS handle
447 * @param[out] size The maximum byte size for text
449 * @return 0 on success, otherwise a negative error value
450 * @retval #TTS_ERROR_NONE Successful
451 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
452 * @retval #TTS_ERROR_INVALID_STATE Invalid state
453 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
455 * @pre The state should be #TTS_STATE_READY.
457 * @see tts_add_text()
459 int tts_get_max_text_size(tts_h tts, unsigned int* size);
462 * @brief Gets the current state of TTS.
463 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
465 * @param[in] tts The TTS handle
466 * @param[out] state The current state of TTS
468 * @return 0 on success, otherwise a negative error value
469 * @retval #TTS_ERROR_NONE Successful
470 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
471 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
477 int tts_get_state(tts_h tts, tts_state_e* state);
480 * @brief Gets the speed range.
481 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
483 * @param[in] tts The TTS handle
484 * @param[out] min The minimun speed value
485 * @param[out] normal The normal speed value
486 * @param[out] max The maximum speed value
488 * @return 0 on success, otherwise a negative error value
489 * @retval #TTS_ERROR_NONE Successful
490 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
491 * @retval #TTS_ERROR_INVALID_STATE Invalid state
492 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
493 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
495 * @pre The state should be #TTS_STATE_CREATED.
497 * @see tts_add_text()
499 int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
502 * @brief Gets the current error message.
505 * @remarks This function should be called during an tts error callback. If not, the error as operation failure will be returned. \n
506 * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
508 * @param[in] tts The TTS handle
509 * @param[out] err_msg The current error message
511 * @return 0 on success, otherwise a negative error value
512 * @retval #TTS_ERROR_NONE Successful
513 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
514 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
515 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
517 * @see tts_set_error_cb()
518 * @see tts_unset_error_cb()
520 int tts_get_error_message(tts_h tts, char** err_msg);
523 * @brief Adds a text to the queue.
524 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
526 * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check.
528 * @param[in] tts The TTS handle
529 * @param[in] text An input text based utf8
530 * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US')
531 * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE)
532 * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range())
533 * @param[out] utt_id The utterance ID passed to the callback function
535 * @return 0 on success, otherwise a negative error value
536 * @retval #TTS_ERROR_NONE Successful
537 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
538 * @retval #TTS_ERROR_INVALID_STATE Invalid state
539 * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
540 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
541 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
542 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
544 * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
545 * @see tts_get_max_text_size()
546 * @see tts_set_credential()
548 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id);
551 * @brief Starts synthesizing voice from the text and plays the synthesized audio data.
552 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
554 * @param[in] tts The TTS handle
556 * @return 0 on success, otherwise a negative error value
557 * @retval #TTS_ERROR_NONE Successful
558 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
559 * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
560 * @retval #TTS_ERROR_INVALID_STATE Invalid state
561 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
562 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
563 * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
565 * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
566 * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
568 * @see tts_add_text()
571 * @see tts_utterance_started_cb()
572 * @see tts_utterance_completed_cb()
573 * @see tts_error_cb()
574 * @see tts_set_credential()
576 int tts_play(tts_h tts);
579 * @brief Stops playing the utterance and clears the queue.
580 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
582 * @param[in] tts The TTS handle
584 * @return 0 on success, otherwise a negative error value
585 * @retval #TTS_ERROR_NONE Successful
586 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
587 * @retval #TTS_ERROR_INVALID_STATE Invalid state
588 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
589 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
591 * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
592 * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
593 * This function will remove all text via tts_add_text() and synthesized sound data.
598 int tts_stop(tts_h tts);
601 * @brief Pauses the currently playing utterance.
602 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
604 * @param[in] tts The TTS handle
606 * @return 0 on success, otherwise a negative error value
607 * @retval #TTS_ERROR_NONE Successful
608 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
609 * @retval #TTS_ERROR_INVALID_STATE Invalid state
610 * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
611 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
613 * @pre The TTS state should be #TTS_STATE_PLAYING.
614 * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
618 * @see tts_error_cb()
619 * @see tts_interrupted_cb()
621 int tts_pause(tts_h tts);
624 * @brief Registers a callback function to be called when the TTS state changes.
625 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
627 * @param[in] tts The TTS handle
628 * @param[in] callback The callback function to register
629 * @param[in] user_data The user data to be passed to the callback function
631 * @return 0 on success, otherwise a negative error value
632 * @retval #TTS_ERROR_NONE Successful
633 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
634 * @retval #TTS_ERROR_INVALID_STATE Invalid state
635 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
637 * @pre The state should be #TTS_STATE_CREATED.
639 * @see tts_state_changed_cb()
640 * @see tts_unset_state_changed_cb()
642 int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
645 * @brief Unregisters the callback function.
646 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
648 * @param[in] tts The TTS handle
650 * @return 0 on success, otherwise a negative error value
651 * @retval #TTS_ERROR_NONE Successful
652 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
653 * @retval #TTS_ERROR_INVALID_STATE Invalid state
654 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
656 * @pre The state should be #TTS_STATE_CREATED.
658 * @see tts_set_state_changed_cb()
660 int tts_unset_state_changed_cb(tts_h tts);
663 * @brief Registers a callback function to detect utterance start.
664 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
666 * @param[in] tts The TTS handle
667 * @param[in] callback The callback function to register
668 * @param[in] user_data The user data to be passed to the callback function
670 * @return 0 on success, otherwise a negative error value
671 * @retval #TTS_ERROR_NONE Successful
672 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
673 * @retval #TTS_ERROR_INVALID_STATE Invalid state
674 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
676 * @pre The state should be #TTS_STATE_CREATED.
678 * @see tts_utterance_started_cb()
679 * @see tts_unset_utterance_started_cb()
681 int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, void* user_data);
684 * @brief Unregisters the callback function.
685 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
687 * @param[in] tts The TTS handle
689 * @return 0 on success, otherwise a negative error value
690 * @retval #TTS_ERROR_NONE Successful
691 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
692 * @retval #TTS_ERROR_INVALID_STATE Invalid state
693 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
695 * @pre The state should be #TTS_STATE_CREATED.
697 * @see tts_set_utterance_started_cb()
699 int tts_unset_utterance_started_cb(tts_h tts);
702 * @brief Registers a callback function to detect utterance completion.
703 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
705 * @param[in] tts The TTS handle
706 * @param[in] callback The callback function to register
707 * @param[in] user_data The user data to be passed to the callback function
709 * @return 0 on success, otherwise a negative error value
710 * @retval #TTS_ERROR_NONE Successful
711 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
712 * @retval #TTS_ERROR_INVALID_STATE Invalid state
713 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
715 * @pre The state should be #TTS_STATE_CREATED.
717 * @see tts_utterance_completed_cb()
718 * @see tts_unset_utterance_completed_cb()
720 int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callback, void* user_data);
723 * @brief Unregisters the callback function.
724 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
726 * @param[in] tts The TTS handle
728 * @return 0 on success, otherwise a negative error value
729 * @retval #TTS_ERROR_NONE Successful
730 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
731 * @retval #TTS_ERROR_INVALID_STATE Invalid state
732 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
734 * @pre The state should be #TTS_STATE_CREATED.
736 * @see tts_set_utterance_completed_cb()
738 int tts_unset_utterance_completed_cb(tts_h tts);
741 * @brief Registers a callback function to detect errors.
742 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
744 * @param[in] tts The TTS handle
745 * @param[in] callback The callback function to register
746 * @param[in] user_data The user data to be passed to the callback function
748 * @return 0 on success, otherwise a negative error value
749 * @retval #TTS_ERROR_NONE Successful
750 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
751 * @retval #TTS_ERROR_INVALID_STATE Invalid state
752 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
754 * @pre The state should be #TTS_STATE_CREATED.
756 * @see tts_error_cb()
757 * @see tts_unset_error_cb()
759 int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
762 * @brief Unregisters the callback function.
763 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
765 * @param[in] tts The TTS handle
767 * @return 0 on success, otherwise a negative error value
768 * @retval #TTS_ERROR_NONE Successful
769 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
770 * @retval #TTS_ERROR_INVALID_STATE Invalid state
771 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
773 * @pre The state should be #TTS_STATE_CREATED.
775 * @see tts_set_error_cb()
777 int tts_unset_error_cb(tts_h tts);
780 * @brief Registers a callback function to detect default voice change.
781 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
783 * @param[in] tts The TTS handle
784 * @param[in] callback The callback function to register
785 * @param[in] user_data The user data to be passed to the callback function
787 * @return 0 on success, otherwise a negative error value
788 * @retval #TTS_ERROR_NONE Successful
789 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
790 * @retval #TTS_ERROR_INVALID_STATE Invalid state
791 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
793 * @pre The state should be #TTS_STATE_CREATED.
795 * @see tts_default_voice_changed_cb()
796 * @see tts_unset_default_voice_changed_cb()
798 int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb callback, void* user_data);
801 * @brief Unregisters the callback function.
802 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
804 * @param[in] tts The TTS handle
806 * @return 0 on success, otherwise a negative error value
807 * @retval #TTS_ERROR_NONE Successful
808 * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
809 * @retval #TTS_ERROR_INVALID_STATE Invalid state
810 * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
812 * @pre The state should be #TTS_STATE_CREATED.
814 * @see tts_set_default_voice_changed_cb()
816 int tts_unset_default_voice_changed_cb(tts_h tts);
827 #endif /* __TTS_H__ */