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