Store current service state from engine library
[platform/core/uifw/tts.git] / include / tts.h
1 /*
2  * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #ifndef __TTS_H__
19 #define __TTS_H__
20
21
22 #include <tizen.h>
23
24
25 /**
26 * @file tts.h
27 */
28
29
30 /**
31 * @addtogroup CAPI_UIX_TTS_MODULE
32 * @{
33 */
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40
41 /**
42  * @brief Enumeration for error code.
43  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
44 */
45 typedef enum {
46         TTS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
47         TTS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
48         TTS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
49         TTS_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
50         TTS_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
51         TTS_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
52         TTS_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
53         TTS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< TTS NOT supported */
54         TTS_ERROR_INVALID_STATE = TIZEN_ERROR_TTS | 0x01, /**< Invalid state */
55         TTS_ERROR_INVALID_VOICE = TIZEN_ERROR_TTS | 0x02, /**< Invalid voice */
56         TTS_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_TTS | 0x03, /**< No available engine */
57         TTS_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
58         TTS_ERROR_AUDIO_POLICY_BLOCKED = TIZEN_ERROR_TTS | 0x05, /**< Audio policy blocked */
59         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 */
60         TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07, /**< Service reset @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
61         TTS_ERROR_SCREEN_READER_OFF = TIZEN_ERROR_TTS | 0x08 /**< Screen reader is off (Since 6.5) */
62 } tts_error_e;
63
64
65 /**
66  * @brief Enumeration for TTS mode.
67  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
68 */
69 typedef enum {
70         TTS_MODE_DEFAULT = 0, /**< Default mode for normal application */
71         TTS_MODE_NOTIFICATION = 1, /**< Notification mode */
72         TTS_MODE_SCREEN_READER = 2 /**< Accessibility mode */
73 } tts_mode_e;
74
75
76 /**
77  * @brief Enumeration for state.
78  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
79 */
80 typedef enum {
81         TTS_STATE_CREATED = 0, /**< 'CREATED' state */
82         TTS_STATE_READY = 1, /**< 'READY' state */
83         TTS_STATE_PLAYING = 2, /**< 'PLAYING' state */
84         TTS_STATE_PAUSED = 3 /**< 'PAUSED' state*/
85 } tts_state_e;
86
87
88 /**
89  * @brief Enumeration for service state.
90  * @since_tizen 7.0
91 */
92 typedef enum {
93         TTS_SERVICE_STATE_NONE = -1, /**< 'None' state */
94         TTS_SERVICE_STATE_READY = 0, /**< 'Ready' state */
95         TTS_SERVICE_STATE_SYNTHESIZING, /**< 'Synthesizing' state */
96         TTS_SERVICE_STATE_PLAYING, /**< 'Playing' state */
97         TTS_SERVICE_STATE_BLOCKED /**< 'Blocked' state */
98 } tts_service_state_e;
99
100
101 /**
102  * @brief Enumeration for synthesized pcm event.
103  * @since_tizen 7.5
104 */
105 typedef enum {
106         TTS_SYNTHESIZED_PCM_EVENT_FAIL = -1, /**< 'Error' event */
107         TTS_SYNTHESIZED_PCM_EVENT_START, /**< 'Started' event */
108         TTS_SYNTHESIZED_PCM_EVENT_CONTINUE, /**< 'Finished' event */
109         TTS_SYNTHESIZED_PCM_EVENT_FINISH, /**< 'Finished' event */
110 } tts_synthesized_pcm_event_e;
111
112
113 /**
114  * @brief Definition for automatic speaking speed.
115  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
116 */
117 #define TTS_SPEED_AUTO          0
118
119
120 /**
121  * @brief Definition for automatic voice type.
122  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
123 */
124 #define TTS_VOICE_TYPE_AUTO     0
125
126
127 /**
128  * @brief Definition for male voice type.
129  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130 */
131 #define TTS_VOICE_TYPE_MALE     1
132
133
134 /**
135  * @brief Definition for female voice type.
136  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
137 */
138 #define TTS_VOICE_TYPE_FEMALE   2
139
140
141 /**
142  * @brief Definition for child voice type.
143  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
144 */
145 #define TTS_VOICE_TYPE_CHILD    3
146
147
148 /**
149  * @brief The TTS handle.
150  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
151 */
152 typedef struct tts_s *tts_h;
153
154
155 /**
156  * @brief Called when the state of TTS is changed.
157  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
158  * @details If the daemon must stop player because of changing engine and
159  *          the daemon must pause player because of other requests, this callback function is called.
160  * @param[in] tts The TTS handle
161  * @param[in] previous The previous state
162  * @param[in] current The current state
163  * @param[in] user_data The user data passed from the callback registration function
164  * @pre An application registers this callback using tts_set_state_changed_cb() to detect changing state.
165  * @see tts_set_state_changed_cb()
166  * @see tts_unset_state_changed_cb()
167 */
168 typedef void (*tts_state_changed_cb)(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data);
169
170
171 /**
172  * @brief Called when utterance has started.
173  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
174  * @param[in] tts The TTS handle
175  * @param[in] utt_id The utterance ID passed from the add text function
176  * @param[in] user_data The user data passed from the callback registration function
177  * @pre An application registers this callback using tts_set_utterance_started_cb() to detect utterance started.
178  * @see tts_add_text()
179  * @see tts_set_utterance_started_cb()
180  * @see tts_unset_utterance_started_cb()
181 */
182 typedef void (*tts_utterance_started_cb)(tts_h tts, int utt_id, void* user_data);
183
184
185 /**
186  * @brief Called when utterance is finished.
187  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
188  * @param[in] tts The TTS handle
189  * @param[in] utt_id The utterance ID passed from the add text function
190  * @param[in] user_data The user data passed from the callback registration function
191  * @pre An application registers this callback using tts_set_utterance_completed_cb() to detect utterance completed.
192  * @see tts_add_text()
193  * @see tts_set_utterance_completed_cb()
194  * @see tts_unset_utterance_completed_cb()
195 */
196 typedef void (*tts_utterance_completed_cb)(tts_h tts, int utt_id, void *user_data);
197
198
199 /**
200  * @brief Called when an error occurs.
201  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
202  * @param[in] tts The TTS handle
203  * @param[in] utt_id The utterance ID passed from the add text function
204  * @param[in] reason The error code
205  * @param[in] user_data The user data passed from the callback registration function
206  * @pre An application registers this callback using tts_set_error_cb() to detect error.
207  * @see tts_play()
208  * @see tts_pause()
209  * @see tts_stop()
210  * @see tts_set_error_cb()
211  * @see tts_unset_error_cb()
212 */
213 typedef void (*tts_error_cb)(tts_h tts, int utt_id, tts_error_e reason, void* user_data);
214
215
216 /**
217  * @brief Called to retrieve the supported voice.
218  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
219  * @param[in] tts The TTS handle
220  * @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)
221  * @param[in] voice_type A voice type (e.g. #TTS_VOICE_TYPE_MALE, #TTS_VOICE_TYPE_FEMALE)
222  * @param[in] user_data The user data passed from the foreach function
223  * @return @c true to continue with the next iteration of the loop,
224  *         @c false to break out of the loop
225  * @pre tts_foreach_supported_voices() will invoke this callback function.
226  * @see tts_foreach_supported_voices()
227 */
228 typedef bool(*tts_supported_voice_cb)(tts_h tts, const char* language, int voice_type, void* user_data);
229
230
231 /**
232  * @brief Called when the default voice is changed.
233  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
234  * @param[in] tts The TTS handle
235  * @param[in] previous_language The previous language
236  * @param[in] previous_voice_type The previous voice type
237  * @param[in] current_language The current language
238  * @param[in] current_voice_type The current voice type
239  * @param[in] user_data The user data passed from the callback registration function
240  * @see tts_set_default_voice_changed_cb()
241 */
242 typedef void (*tts_default_voice_changed_cb)(tts_h tts, const char* previous_language, int previous_voice_type,
243                                 const char* current_language, int current_voice_type, void* user_data);
244
245
246 /**
247  * @brief Called when the engine is changed.
248  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
249  * @param[in] tts The TTS handle
250  * @param[in] engine_id Engine ID
251  * @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)
252  * @param[in] voice_type The default voice type
253  * @param[in] need_credential The necessity of credential
254  * @param[in] user_data The user data passed from the callback registration function
255  * @see tts_set_engine_changed_cb()
256 */
257 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);
258
259
260 /**
261  * @brief Called when the option of screen reader is changed.
262  * @since_tizen 6.5
263  * @param[in] tts The TTS handle
264  * @param[in] is_on The status of screen reader. If @a is_on is @c true, screen reader is turned on. If not, it is turned off.
265  * @param[in] user_data The user data passed from the callback registration function
266  * @see tts_set_screen_reader_changed_cb()
267 */
268 typedef void (*tts_screen_reader_changed_cb)(tts_h tts, bool is_on, void* user_data);
269
270
271 /**
272  * @brief Called when the state of TTS service is changed.
273  * @since_tizen 7.0
274  * @remarks The @a tts handle should not be destroyed in the callback.
275  * @param[in] tts The TTS handle, the same handle for which the callback was set.
276  * @param[in] previous The previous state of TTS service
277  * @param[in] current The current state of TTS service
278  * @param[in] user_data The user data passed from the callback registration function
279  * @pre An application registers this callback using tts_set_service_state_changed_cb() to detect changing state of TTS service.
280  * @see tts_set_service_state_changed_cb()
281  * @see tts_unset_service_state_changed_cb()
282 */
283 typedef void (*tts_service_state_changed_cb)(tts_h tts, tts_service_state_e previous, tts_service_state_e current, void* user_data);
284
285
286 /**
287  * @brief Called when the synthesized pcm data is come from the engine.
288  * @since_tizen 7.5
289  * @remarks The @a tts handle should not be destroyed in the callback.
290  * @param[in] tts The TTS handle, the same handle for which the callback was set.
291  * @param[in] event The event type
292  * @param[in] buffer The synthesized pcm data
293  * @param[in] buffer_size The size of the buffer
294  * @param[in] user_data The user data passed from the callback registration function
295  * @pre An application registers this callback using tts_set_synthesized_pcm_cb() to get pcm data.
296  * @see tts_set_synthesized_pcm_cb()
297  * @see tts_unset_synthesized_pcm_cb()
298  */
299 typedef void (*tts_synthesized_pcm_cb)(tts_h tts, tts_synthesized_pcm_event_e event, char* buffer, int buffer_size, void *user_data);
300
301
302 /**
303  * @brief Creates a handle for TTS.
304  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
305  * @remarks If the function succeeds, @a tts handle must be released with tts_destroy().
306  * @param[out] tts The TTS handle
307  * @return @c 0 on success,
308  *         otherwise a negative error value
309  * @retval #TTS_ERROR_NONE Successful
310  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
311  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
312  * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
313  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
314  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
315  * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
316  * @see tts_destroy()
317 */
318 int tts_create(tts_h* tts);
319
320
321 /**
322  * @brief Destroys the handle and disconnects the daemon.
323  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
324  * @param[in] tts The TTS handle
325  * @return @c 0 on success,
326  *         otherwise a negative error value
327  * @retval #TTS_ERROR_NONE Successful
328  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
329  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
330  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
331  * @see tts_create()
332 */
333 int tts_destroy(tts_h tts);
334
335
336 /**
337  * @brief Sets the TTS mode.
338  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
339  * @param[in] tts The TTS handle
340  * @param[in] mode The mode
341  * @return @c 0 on success,
342  *         otherwise a negative error value
343  * @retval #TTS_ERROR_NONE Successful
344  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
345  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
346  * @retval #TTS_ERROR_INVALID_STATE Invalid state
347  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
348  * @pre The state should be #TTS_STATE_CREATED.
349  * @see tts_get_mode()
350 */
351 int tts_set_mode(tts_h tts, tts_mode_e mode);
352
353
354 /**
355  * @brief Gets the TTS mode.
356  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
357  * @param[in] tts The TTS handle
358  * @param[out] mode The mode
359  * @return @c 0 on success,
360  *         otherwise a negative error value
361  * @retval #TTS_ERROR_NONE Successful
362  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
363  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
364  * @retval #TTS_ERROR_INVALID_STATE Invalid state
365  * @pre The state should be #TTS_STATE_CREATED.
366  * @see tts_set_mode()
367 */
368 int tts_get_mode(tts_h tts, tts_mode_e* mode);
369
370
371 /**
372  * @brief Sets the app credential.
373  * @details Using this API, the application can set a credential.
374  *          The credential is a key to verify the authorization about using the engine.
375  *          If the application sets the credential, it will be able to use functions of the engine entirely.
376  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
377  * @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.
378  *          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.
379  * @param[in] tts The TTS handle
380  * @param[in] credential The app credential
381  * @return @c 0 on success,
382  *         otherwise a negative error value
383  * @retval #TTS_ERROR_NONE Success
384  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
385  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
386  * @retval #TTS_ERROR_INVALID_STATE Invalid state
387  * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
388  * @see tts_play()
389 */
390 int tts_set_credential(tts_h tts, const char* credential);
391
392
393 /**
394  * @brief Connects the daemon asynchronously.
395  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
396  * @param[in] tts The TTS handle
397  * @return @c 0 on success,
398  *         otherwise a negative error value
399  * @retval #TTS_ERROR_NONE Successful
400  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
401  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
402  * @retval #TTS_ERROR_INVALID_STATE Invalid state
403  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
404  * @pre The state should be #TTS_STATE_CREATED.
405  * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
406  *       If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
407  * @see tts_unprepare()
408 */
409 int tts_prepare(tts_h tts);
410
411
412 /**
413  * @brief Disconnects the daemon.
414  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
415  * @param[in] tts The TTS handle
416  * @return @c 0 on success,
417  *         otherwise a negative error value
418  * @retval #TTS_ERROR_NONE Successful
419  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
420  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
421  * @retval #TTS_ERROR_INVALID_STATE Invalid state
422  * @pre The state should be #TTS_STATE_READY.
423  * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
424  * @see tts_prepare()
425 */
426 int tts_unprepare(tts_h tts);
427
428
429 /**
430  * @brief Connects the daemon synchronously.
431  * @since_tizen 7.0
432  * @param[in] tts The TTS handle
433  * @return @c 0 on success,
434  *         otherwise a negative error value
435  * @retval #TTS_ERROR_NONE Successful
436  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
437  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
438  * @retval #TTS_ERROR_INVALID_STATE Invalid state
439  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
440  * @pre The state should be #TTS_STATE_CREATED.
441  * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
442  * @see tts_unprepare()
443 */
444 int tts_prepare_sync(tts_h tts);
445
446
447 /**
448  * @brief Retrieves all supported voices of the current engine using callback function.
449  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
450  * @param[in] tts The TTS handle
451  * @param[in] callback The callback function to invoke
452  * @param[in] user_data The user data to be passed to the callback function
453  * @return @c 0 on success,
454  *         otherwise a negative error value
455  * @retval #TTS_ERROR_NONE Successful
456  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
457  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
458  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
459  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
460  * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
461  * @see tts_get_default_voice()
462 */
463 int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data);
464
465
466 /**
467  * @brief Gets the default voice set by the user.
468  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
469  * @remarks If the function succeeds, @a language must be released with free().
470  * @param[in] tts The TTS handle
471  * @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)
472  * @param[out] voice_type The voice type
473  * @return @c 0 on success,
474  *         otherwise a negative error value
475  * @retval #TTS_ERROR_NONE Successful
476  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
477  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
478  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
479  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
480  * @see tts_foreach_supported_voices()
481 */
482 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
483
484
485 /**
486  * @brief Sets the private data to tts engine.
487  * @details The private data is the setting parameter for applying keys provided by the engine.
488  *          Using this API, the application can set the private data and use the corresponding key of the engine.
489  *          For example, if the engine provides 'girl's voice' as a voice type, the application can set the private data as the following.
490  *          int ret = tts_set_private_data(tts_h, "voice_type", "GIRL");
491  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
492  * @remarks If the engine is replaced with the other engine, the key may be ignored.
493  * @param[in] tts The TTS handle
494  * @param[in] key The field name of private data
495  * @param[in] data The data for set
496  * @return @c 0 on success,
497  *         otherwise a negative error value
498  * @retval #TTS_ERROR_NONE Successful
499  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
500  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
501  * @retval #TTS_ERROR_INVALID_STATE Invalid state
502  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
503  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
504  * @pre The state should be #TTS_STATE_READY.
505  * @see tts_get_private_data()
506 */
507 int tts_set_private_data(tts_h tts, const char* key, const char* data);
508
509
510 /**
511  * @brief Gets the private data from tts engine.
512  * @details The private data is the information provided by the engine.
513  *          Using this API, the application can get the private data which corresponds to the key from the engine.
514  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
515  * @remarks The @a data must be released using free() when it is no longer required.
516  *          If the engine is replaced with the other engine, the key may be ignored.
517  * @param[in] tts The TTS handle
518  * @param[in] key The field name of private data
519  * @param[out] data The data field of private data
520  * @return @c 0 on success,
521  *         otherwise a negative error value
522  * @retval #TTS_ERROR_NONE Successful
523  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
524  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
525  * @retval #TTS_ERROR_INVALID_STATE Invalid state
526  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
527  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
528  * @pre The state should be #TTS_STATE_READY.
529  * @see tts_set_private_data()
530 */
531 int tts_get_private_data(tts_h tts, const char* key, char** data);
532
533
534 /**
535  * @brief Gets the maximum byte size for text.
536  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
537  * @param[in] tts The TTS handle
538  * @param[out] size The maximum byte size for text
539  * @return @c 0 on success,
540  *         otherwise a negative error value
541  * @retval #TTS_ERROR_NONE Successful
542  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
543  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
544  * @retval #TTS_ERROR_INVALID_STATE Invalid state
545  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
546  * @pre The state should be #TTS_STATE_READY.
547  * @see tts_add_text()
548 */
549 int tts_get_max_text_size(tts_h tts, unsigned int* size);
550
551
552 /**
553  * @brief Gets the current state of TTS.
554  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
555  * @param[in] tts The TTS handle
556  * @param[out] state The current state of TTS
557  * @return @c 0 on success,
558  *         otherwise a negative error value
559  * @retval #TTS_ERROR_NONE Successful
560  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
561  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
562  * @see tts_play()
563  * @see tts_stop()
564  * @see tts_pause()
565 */
566 int tts_get_state(tts_h tts, tts_state_e* state);
567
568
569 /**
570  * @brief Gets the speed range.
571  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
572  * @param[in] tts The TTS handle
573  * @param[out] min The minimum speed value
574  * @param[out] normal The normal speed value
575  * @param[out] max The maximum speed value
576  * @return @c 0 on success,
577  *         otherwise a negative error value
578  * @retval #TTS_ERROR_NONE Successful
579  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
580  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
581  * @retval #TTS_ERROR_INVALID_STATE Invalid state
582  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
583  * @pre The state should be #TTS_STATE_CREATED.
584  * @see tts_add_text()
585 */
586 int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
587
588
589 /**
590  * @brief Gets the current error message.
591  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
592  * @remarks This function should be called from a tts error callback. Calling in any other context will result in an Operation failed error.
593  *          A successful call will allocate @a err_msg, which must be released by calling free() when it is no longer required.
594  * @param[in] tts The TTS handle
595  * @param[out] err_msg The current error message
596  * @return @c 0 on success,
597  *         otherwise a negative error value
598  * @retval #TTS_ERROR_NONE Successful
599  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
600  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
601  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
602  * @see tts_set_error_cb()
603  * @see tts_unset_error_cb()
604 */
605 int tts_get_error_message(tts_h tts, char** err_msg);
606
607
608 /**
609  * @brief Gets the current state of TTS service.
610  * @since_tizen 7.0
611  * @param[in] tts The TTS handle
612  * @param[out] service_state The current state of TTS service
613  * @return @c 0 on success,
614  *         otherwise a negative error value
615  * @retval #TTS_ERROR_NONE Successful
616  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
617  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
618  * @retval #TTS_ERROR_INVALID_STATE Invalid state
619  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
620  * @pre The TTS state should be one of: #TTS_STATE_READY, #TTS_STATE_PLAYING, #TTS_STATE_PAUSED.
621  * @see tts_play()
622  * @see tts_stop()
623  * @see tts_pause()
624 */
625 int tts_get_service_state(tts_h tts, tts_service_state_e* service_state);
626
627
628 /**
629  * @brief Checks whether screen reader is turned on or not.
630  * @since_tizen 6.5
631  * @remarks If TTS mode is #TTS_MODE_SCREEN_READER, you should call this function to check whether screen reader is turned on or not, before calling 'tts_prepare()'.
632  *          If TTS mode is #TTS_MODE_SCREEN_READER and @a is_on is @c false, all other functions will return #TTS_ERROR_SCREEN_READER_OFF.
633  *          The @a is_on must be released using free() when it is no longer required.
634  * @param[in] tts The TTS handle
635  * @param[out] is_on The current status of screen reader
636  * @return @c 0 on success,
637  *         otherwise a negative error value
638  * @retval #TTS_ERROR_NONE Successful
639  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
640  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
641  * @see tts_set_screen_reader_changed_cb()
642  * @see tts_unset_screen_reader_changed_cb()
643 */
644 int tts_check_screen_reader_on(tts_h tts, bool* is_on);
645
646
647 /**
648  * @brief Adds a text to the queue.
649  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
650  * @remarks Locale(e.g. setlocale()) MUST be set for utf8 text validation check.
651  * @param[in] tts The TTS handle
652  * @param[in] text An input text based utf8
653  * @param[in] language The language selected from the tts_foreach_supported_voices() (e.g. 'NULL'(Automatic), 'en_US')
654  * @param[in] voice_type The voice type selected from the tts_foreach_supported_voices() (e.g. #TTS_VOICE_TYPE_AUTO, #TTS_VOICE_TYPE_FEMALE)
655  * @param[in] speed A speaking speed (e.g. #TTS_SPEED_AUTO or the value from tts_get_speed_range())
656  * @param[out] utt_id The utterance ID passed to the callback function
657  * @return @c 0 on success,
658  *         otherwise a negative error value
659  * @retval #TTS_ERROR_NONE Successful
660  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
661  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
662  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
663  * @retval #TTS_ERROR_INVALID_STATE Invalid state
664  * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
665  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
666  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
667  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
668  * @see tts_get_max_text_size()
669  * @see tts_set_credential()
670 */
671 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id);
672
673
674 /**
675  * @brief Starts synthesizing voice from the text and plays the synthesized audio data.
676  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
677  * @param[in] tts The TTS handle
678  * @return @c 0 on success,
679  *         otherwise a negative error value
680  * @retval #TTS_ERROR_NONE Successful
681  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
682  * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
683  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
684  * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
685  * @retval #TTS_ERROR_INVALID_STATE Invalid state
686  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
687  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
688  * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
689  * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
690  * @see tts_add_text()
691  * @see tts_pause()
692  * @see tts_stop()
693  * @see tts_utterance_started_cb()
694  * @see tts_utterance_completed_cb()
695  * @see tts_error_cb()
696  * @see tts_set_credential()
697 */
698 int tts_play(tts_h tts);
699
700
701 /**
702  * @brief Stops playing the utterance and clears the queue.
703  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704  * @param[in] tts The TTS handle
705  * @return @c 0 on success,
706  *         otherwise a negative error value
707  * @retval #TTS_ERROR_NONE Successful
708  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
709  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
710  * @retval #TTS_ERROR_INVALID_STATE Invalid state
711  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
712  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
713  * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
714  * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
715  *       This function will remove all text via tts_add_text() and synthesized sound data.
716  * @see tts_play()
717  * @see tts_pause()
718 */
719 int tts_stop(tts_h tts);
720
721
722 /**
723  * @brief Pauses the currently playing utterance.
724  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
725  * @param[in] tts The TTS handle
726  * @return @c 0 on success,
727  *         otherwise a negative error value
728  * @retval #TTS_ERROR_NONE Successful
729  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
730  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
731  * @retval #TTS_ERROR_INVALID_STATE Invalid state
732  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
733  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
734  * @pre The TTS state should be #TTS_STATE_PLAYING.
735  * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
736  * @see tts_play()
737  * @see tts_stop()
738  * @see tts_error_cb()
739 */
740 int tts_pause(tts_h tts);
741
742 /**
743  * @brief Repeats the last added text.
744  * @since_tizen 5.0
745  * @remarks This function repeats the last added text once again.
746  *          If there is no previously added text, this function will not work.
747  *          If the language is changed, the last added text is removed from the service.
748  *          Before calling this function, please call 'tts_stop()' in order to stop playing the previous one.
749  *          If this function succeeds, @a text_repeat must be released with free().
750  * @param[in] tts The TTS handle
751  * @param[out] text_repeat Texts to be played repeatedly
752  * @param[out] utt_id The utterance ID passed to the callback function
753  *
754  * @return @c 0 on success,
755  *         otherwise a negative error value
756  * @retval #TTS_ERROR_NONE Successful
757  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
758  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
759  * @retval #TTS_ERROR_INVALID_STATE Invalid state
760  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
761  * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
762  * @pre The state should be #TTS_STATE_READY.
763  * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
764  * @see tts_add_text()
765  * @see tts_stop()
766  */
767 int tts_repeat(tts_h tts, char** text_repeat, int* utt_id);
768
769 /**
770  * @brief Registers a callback function to be called when the TTS state changes.
771  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
772  * @param[in] tts The TTS handle
773  * @param[in] callback The callback function to register
774  * @param[in] user_data The user data to be passed to the callback function
775  * @return @c 0 on success,
776  *         otherwise a negative error value
777  * @retval #TTS_ERROR_NONE Successful
778  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
779  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
780  * @retval #TTS_ERROR_INVALID_STATE Invalid state
781  * @pre The state should be #TTS_STATE_CREATED.
782  * @see tts_state_changed_cb()
783  * @see tts_unset_state_changed_cb()
784 */
785 int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
786
787
788 /**
789  * @brief Unregisters the callback function.
790  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
791  * @param[in] tts The TTS handle
792  * @return @c 0 on success,
793  *         otherwise a negative error value
794  * @retval #TTS_ERROR_NONE Successful
795  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
796  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
797  * @retval #TTS_ERROR_INVALID_STATE Invalid state
798  * @pre The state should be #TTS_STATE_CREATED.
799  * @see tts_set_state_changed_cb()
800 */
801 int tts_unset_state_changed_cb(tts_h tts);
802
803
804 /**
805  * @brief Registers a callback function to detect utterance start.
806  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
807  * @param[in] tts The TTS handle
808  * @param[in] callback The callback function to register
809  * @param[in] user_data The user data to be passed to the callback function
810  * @return @c 0 on success,
811  *         otherwise a negative error value
812  * @retval #TTS_ERROR_NONE Successful
813  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
814  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
815  * @retval #TTS_ERROR_INVALID_STATE Invalid state
816  * @pre The state should be #TTS_STATE_CREATED.
817  * @see tts_utterance_started_cb()
818  * @see tts_unset_utterance_started_cb()
819 */
820 int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, void* user_data);
821
822
823 /**
824  * @brief Unregisters the callback function.
825  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
826  * @param[in] tts The TTS handle
827  * @return @c 0 on success,
828  *         otherwise a negative error value
829  * @retval #TTS_ERROR_NONE Successful
830  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
831  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
832  * @retval #TTS_ERROR_INVALID_STATE Invalid state
833  * @pre The state should be #TTS_STATE_CREATED.
834  * @see tts_set_utterance_started_cb()
835 */
836 int tts_unset_utterance_started_cb(tts_h tts);
837
838
839 /**
840  * @brief Registers a callback function to detect utterance completion.
841  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
842  * @param[in] tts The TTS handle
843  * @param[in] callback The callback function to register
844  * @param[in] user_data The user data to be passed to the callback function
845  * @return @c 0 on success,
846  *         otherwise a negative error value
847  * @retval #TTS_ERROR_NONE Successful
848  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
849  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
850  * @retval #TTS_ERROR_INVALID_STATE Invalid state
851  * @pre The state should be #TTS_STATE_CREATED.
852  * @see tts_utterance_completed_cb()
853  * @see tts_unset_utterance_completed_cb()
854 */
855 int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callback, void* user_data);
856
857
858 /**
859  * @brief Unregisters the callback function.
860  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
861  * @param[in] tts The TTS handle
862  * @return @c 0 on success,
863  *         otherwise a negative error value
864  * @retval #TTS_ERROR_NONE Successful
865  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
866  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
867  * @retval #TTS_ERROR_INVALID_STATE Invalid state
868  * @pre The state should be #TTS_STATE_CREATED.
869  * @see tts_set_utterance_completed_cb()
870 */
871 int tts_unset_utterance_completed_cb(tts_h tts);
872
873
874 /**
875  * @brief Registers a callback function to detect errors.
876  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
877  * @param[in] tts The TTS handle
878  * @param[in] callback The callback function to register
879  * @param[in] user_data The user data to be passed to the callback function
880  * @return @c 0 on success,
881  *         otherwise a negative error value
882  * @retval #TTS_ERROR_NONE Successful
883  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
884  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
885  * @retval #TTS_ERROR_INVALID_STATE Invalid state
886  * @pre The state should be #TTS_STATE_CREATED.
887  * @see tts_error_cb()
888  * @see tts_unset_error_cb()
889 */
890 int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
891
892
893 /**
894  * @brief Unregisters the callback function.
895  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
896  * @param[in] tts The TTS handle
897  * @return @c 0 on success,
898  *         otherwise a negative error value
899  * @retval #TTS_ERROR_NONE Successful
900  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
901  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
902  * @retval #TTS_ERROR_INVALID_STATE Invalid state
903  * @pre The state should be #TTS_STATE_CREATED.
904  * @see tts_set_error_cb()
905 */
906 int tts_unset_error_cb(tts_h tts);
907
908
909 /**
910  * @brief Registers a callback function to detect default voice change.
911  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
912  * @param[in] tts The TTS handle
913  * @param[in] callback The callback function to register
914  * @param[in] user_data The user data to be passed to the callback function
915  * @return @c 0 on success,
916  *         otherwise a negative error value
917  * @retval #TTS_ERROR_NONE Successful
918  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
919  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
920  * @retval #TTS_ERROR_INVALID_STATE Invalid state
921  * @pre The state should be #TTS_STATE_CREATED.
922  * @see tts_default_voice_changed_cb()
923  * @see tts_unset_default_voice_changed_cb()
924 */
925 int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb callback, void* user_data);
926
927
928 /**
929  * @brief Unregisters the callback function.
930  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
931  * @param[in] tts The TTS handle
932  * @return @c 0 on success,
933  *         otherwise a negative error value
934  * @retval #TTS_ERROR_NONE Successful
935  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
936  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
937  * @retval #TTS_ERROR_INVALID_STATE Invalid state
938  * @pre The state should be #TTS_STATE_CREATED.
939  * @see tts_set_default_voice_changed_cb()
940 */
941 int tts_unset_default_voice_changed_cb(tts_h tts);
942
943
944  /**
945  * @brief Registers a callback function to detect the engine change.
946  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
947  * @param[in] tts The TTS handle
948  * @param[in] callback The callback function to register
949  * @param[in] user_data The user data to be passed to the callback function
950  * @return @c 0 on success,
951  *         otherwise a negative error value
952  * @retval #TTS_ERROR_NONE Successful
953  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
954  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
955  * @retval #TTS_ERROR_INVALID_STATE Invalid state
956  * @pre The state should be #TTS_STATE_CREATED.
957  * @see tts_engine_changed_cb()
958  * @see tts_unset_engine_changed_cb()
959 */
960 int tts_set_engine_changed_cb(tts_h tts, tts_engine_changed_cb callback, void* user_data);
961
962
963 /**
964  * @brief Unregisters the callback function.
965  * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 2.3.2 @endif
966  * @param[in] tts The TTS handle
967  * @return @c 0 on success,
968  *         otherwise a negative error value
969  * @retval #TTS_ERROR_NONE Successful
970  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
971  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
972  * @retval #TTS_ERROR_INVALID_STATE Invalid state
973  * @pre The state should be #TTS_STATE_CREATED.
974  * @see tts_set_engine_changed_cb()
975 */
976 int tts_unset_engine_changed_cb(tts_h tts);
977
978
979 /**
980  * @brief Registers a callback function to detect the option of screen reader is changed or not.
981  * @since_tizen 6.5
982  * @remarks If TTS mode is #TTS_MODE_SCREEN_READER, you should set the callback to check the option of screen reader is changed or not.
983  * @param[in] tts The TTS handle
984  * @param[in] callback The callback function to register
985  * @param[in] user_data The user data to be passed to the callback function
986  * @return @c 0 on success,
987  *         otherwise a negative error value
988  * @retval #TTS_ERROR_NONE Successful
989  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
990  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
991  * @retval #TTS_ERROR_INVALID_STATE Invalid state
992  * @pre The state should be #TTS_STATE_CREATED.
993  * @see tts_screen_reader_changed_cb()
994  * @see tts_unset_screen_reader_changed_cb()
995 */
996 int tts_set_screen_reader_changed_cb(tts_h tts, tts_screen_reader_changed_cb callback, void* user_data);
997
998
999 /**
1000  * @brief Unregisters the callback function to detect the option of screen reader is changed or not.
1001  * @since_tizen 6.5
1002  * @param[in] tts The TTS handle
1003  * @return @c 0 on success,
1004  *         otherwise a negative error value
1005  * @retval #TTS_ERROR_NONE Successful
1006  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
1007  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
1008  * @retval #TTS_ERROR_INVALID_STATE Invalid state
1009  * @pre The state should be #TTS_STATE_CREATED.
1010  * @see tts_set_screen_reader_changed_cb()
1011 */
1012 int tts_unset_screen_reader_changed_cb(tts_h tts);
1013
1014 /**
1015  * @brief Sets a callback function to be called when the TTS service state changes.
1016  * @since_tizen 7.0
1017  * @param[in] tts The TTS handle
1018  * @param[in] callback The callback function to register
1019  * @param[in] user_data The user data to be passed to the callback function
1020  * @return @c 0 on success,
1021  *         otherwise a negative error value
1022  * @retval #TTS_ERROR_NONE Successful
1023  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
1024  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
1025  * @retval #TTS_ERROR_INVALID_STATE Invalid state
1026  * @pre The TTS state should be #TTS_STATE_CREATED.
1027  * @see tts_service_state_changed_cb()
1028  * @see tts_unset_service_state_changed_cb()
1029 */
1030 int tts_set_service_state_changed_cb(tts_h tts, tts_service_state_changed_cb callback, void* user_data);
1031
1032 /**
1033  * @brief Unsets the callback function.
1034  * @since_tizen 7.0
1035  * @param[in] tts The TTS handle
1036  * @return @c 0 on success,
1037  *         otherwise a negative error value
1038  * @retval #TTS_ERROR_NONE Successful
1039  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
1040  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
1041  * @retval #TTS_ERROR_INVALID_STATE Invalid state
1042  * @pre The TTS state should be #TTS_STATE_CREATED.
1043  * @see tts_set_service_state_changed_cb()
1044 */
1045 int tts_unset_service_state_changed_cb(tts_h tts);
1046
1047
1048 /**
1049  * @brief Sets the default to be called when the synthesized pcm data is recieved.
1050  * @since_tizen 7.5
1051  * @param[in] tts The TTS handle
1052  * @param callback The callback function to register
1053  * @param user_data The user data to be passed to the callback function
1054  * @return @c 0 on success,
1055  *                 otherwise a negative error value
1056  * @retval #TTS_ERROR_NONE Successful
1057  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
1058  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
1059  * @retval #TTS_ERROR_INVALID_STATE Invalid state
1060  * @pre The TTS state should be #TTS_STATE_CREATED.
1061  * @see tts_synthesized_pcm_cb()
1062  * @see tts_unset_synthesized_pcm_cb()
1063  */
1064 int tts_set_synthesized_pcm_cb(tts_h tts, tts_synthesized_pcm_cb callback, void* user_data);
1065
1066
1067 /**
1068  * @brief Unsets the callback function.
1069  * @since_tizen 7.5
1070  * @param tts The TTS handle
1071  * @return @c 0 on success,
1072  *                 otherwise a negative error value
1073  * @retval #TTS_ERROR_NONE Successful
1074  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
1075  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
1076  * @retval #TTS_ERROR_INVALID_STATE Invalid state
1077  * @pre The TTS state should be #TTS_STATE_CREATED.
1078  * @see tts_set_synthesized_pcm_cb()
1079   */
1080 int tts_unset_synthesized_pcm_cb(tts_h tts);
1081
1082 #ifdef __cplusplus
1083 }
1084 #endif
1085
1086
1087 /**
1088  * @}
1089  */
1090
1091
1092 #endif  /* __TTS_H__ */