2 * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
23 * @addtogroup CAPI_UIX_TTSE_MODULE
34 * @brief Enumeration for error codes.
38 TTSE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
39 TTSE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
40 TTSE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
41 TTSE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
42 TTSE_ERROR_NETWORK_DOWN = TIZEN_ERROR_NETWORK_DOWN, /**< Out of network */
43 TTSE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
44 TTSE_ERROR_INVALID_STATE = TIZEN_ERROR_TTS | 0x01, /**< Invalid state */
45 TTSE_ERROR_INVALID_VOICE = TIZEN_ERROR_TTS | 0x02, /**< Invalid voice */
46 TTSE_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
47 TTSE_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature */
48 TTSE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported */
53 * @brief Enumeration for audio type.
57 TTSE_AUDIO_TYPE_RAW_S16 = 0, /**< Signed 16-bit audio type */
58 TTSE_AUDIO_TYPE_RAW_U8, /**< Unsigned 8-bit audio type */
64 * @brief Enumeration for result event type.
68 TTSE_RESULT_EVENT_FAIL = -1, /**< Event when the voice synthesis is failed */
69 TTSE_RESULT_EVENT_START = 1, /**< Event when the sound data is first data by callback function */
70 TTSE_RESULT_EVENT_CONTINUE = 2, /**< Event when the next sound data exist, not first and not last */
71 TTSE_RESULT_EVENT_FINISH = 3 /**< Event when the sound data is last data or sound data is only one result */
72 } ttse_result_event_e;
76 * @brief Definition for male voice type.
79 #define TTSE_VOICE_TYPE_MALE 1
83 * @brief Definition for female voice type.
86 #define TTSE_VOICE_TYPE_FEMALE 2
90 * @brief Definition for child's voice type.
93 #define TTSE_VOICE_TYPE_CHILD 3
96 * @brief Called when TTS engine informs the engine service user about whole supported language and voice type list.
97 * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
99 * @remarks This callback function is called by ttse_foreach_supported_voices_cb() to inform the whole supported voice list.
100 * @a user_data must be transferred from ttse_foreach_supported_voices_cb().
101 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
102 * followed by ISO 639-1 for the two-letter language code.
103 * For example, "ko_KR" for Korean, "en_US" for American English
104 * @param[in] type The voice type
105 * @param[in] user_data The user data passed from ttse_foreach_supported_voices_cb()
106 * @return @c true to continue with the next iteration of the loop
107 * @c false to break out of the loop
108 * @pre ttse_foreach_supported_voices_cb() will invoke this callback function.
109 * @see ttse_foreach_supported_voices_cb()
111 typedef bool (*ttse_supported_voice_cb)(const char* language, int type, void* user_data);
115 * @brief Called when the engine service user initializes TTS engine.
117 * @remarks This callback function is mandatory and must be registered using ttse_main().
118 * @return @c 0 on success,
119 * otherwise a negative error value
120 * @retval #TTSE_ERROR_NONE Successful
121 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
122 * @retval #TTSE_ERROR_INVALID_STATE Already initialized
123 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
124 * @retval #TTSE_ERROR_PERMISSION_DENIED Permission denied
125 * @see ttse_deinitialize_cb()
127 typedef int (*ttse_initialize_cb)(void);
131 * @brief Called when the engine service user deinitializes TTS engine.
133 * @remarks This callback function is mandatory and must be registered using ttse_main().
134 * NOTE that the engine may be terminated automatically.
135 * When this callback function is invoked, the release of resources is necessary.
136 * @return @c 0 on success,
137 * otherwise a negative error value
138 * @retval #TTSE_ERROR_NONE Successful
139 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
140 * @see ttse_initialize_cb()
142 typedef int (*ttse_deinitialize_cb)(void);
146 * @brief Called when the engine service user gets the whole supported voice list.
148 * @remarks This callback function is mandatory and must be registered using ttse_main().
149 * In this function, the engine service user's callback function 'ttse_supported_voice_cb()' is invoked repeatedly for getting all supported voices, and @a user_data must be transferred to 'ttse_supported_voice_cb()'.
150 * If 'ttse_supported_voice_cb()' returns @c false, it should be stopped to call 'ttse_supported_voice_cb()'.
151 * @param[in] callback The callback function
152 * @param[in] user_data The user data which must be passed to ttse_supported_voice_cb()
153 * @return @c 0 on success,
154 * otherwise a negative error value
155 * @retval #TTSE_ERROR_NONE Successful
156 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
157 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
158 * @post This callback function invokes ttse_supported_voice_cb() repeatedly for getting all supported voices.
159 * @see ttse_supported_voice_cb()
161 typedef int (*ttse_foreach_supported_voices_cb)(ttse_supported_voice_cb callback, void* user_data);
165 * @brief Called when the engine service user checks whether the voice is valid or not in TTS engine.
167 * @remarks This callback function is mandatory and must be registered using ttse_main().
168 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
169 * followed by ISO 639-1 for the two-letter language code.
170 * For example, "ko_KR" for Korean, "en_US" for American English
171 * @param[in] type The voice type
172 * @param[out] is_valid A variable for checking whether the corresponding voice is valid or not.
173 * @c true to be valid,
174 * @c false to be invalid
175 * @return @c 0 on success,
176 * otherwise a negative error value
177 * @retval #TTSE_ERROR_NONE Successful
178 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
179 * @see ttse_foreach_supported_voices_cb()
181 typedef int (*ttse_is_valid_voice_cb)(const char* language, int type, bool* is_valid);
185 * @brief Called when the engine service user sets the default pitch of TTS engine.
187 * @remarks This callback function is mandatory and must be registered using ttse_main().
188 * @param[in] pitch The default pitch
189 * @return @c 0 on success,
190 * otherwise a negative error value
191 * @retval #TTSE_ERROR_NONE Successful
192 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
193 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
194 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
196 typedef int (*ttse_set_pitch_cb)(int pitch);
200 * @brief Called when the engine service user requests to load the corresponding voice type for the first time.
202 * @remarks This callback function is mandatory and must be registered using ttse_main().
203 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
204 * followed by ISO 639-1 for the two-letter language code.
205 * For example, "ko_KR" for Korean, "en_US" for American English
206 * @param[in] type The voice type
207 * @return @c 0 on success,
208 * otherwise a negative error value
209 * @retval #TTSE_ERROR_NONE Successful
210 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
211 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
212 * @retval #TTSE_ERROR_OUT_OF_MEMORY Out of memory
213 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
214 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
215 * @see ttse_unload_voice_cb()
217 typedef int (*ttse_load_voice_cb)(const char* language, int type);
221 * @brief Called when the engine service user requests to unload the corresponding voice type or to stop using voice.
223 * @remarks This callback function is mandatory and must be registered using ttse_main().
224 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
225 * followed by ISO 639-1 for the two-letter language code.
226 * For example, "ko_KR" for Korean, "en_US" for American English
227 * @param[in] type The voice type
228 * @return @c 0 on success,
229 * otherwise a negative error value
230 * @retval #TTSE_ERROR_NONE Successful
231 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
232 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
233 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
234 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
235 * @see ttse_load_voice_cb()
237 typedef int (*ttse_unload_voice_cb)(const char* language, int type);
241 * @brief Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine.
242 * @details This callback function is called when the engine service user requests for TTS engine to check the application's agreement about using the engine.
243 * According to the need, the engine developer can provide some user interfaces to check the agreement.
245 * @remarks This callback function is mandatory and must be registered using ttse_main().
246 * If the TTS engine developer wants not to check the agreement, the developer has need to return proper values as @a is_agreed in accordance with the intention. @c true if the developer regards that every application agreed the usage of the engine, @c false if the developer regards that every application disagreed.
247 * NOTE that, however, there may be any legal issue unless the developer checks the agreement. Therefore, we suggest that the engine developers should provide a function to check the agreement.
248 * @param[in] appid The Application ID
249 * @param[out] is_agreed A variable for checking whether the application agreed to use TTS engine or not.
251 * @c false to disagree
252 * @return @c 0 on success,
253 * otherwise a negative error value
254 * @retval #TTSE_ERROR_NONE Successful
255 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
256 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
257 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
259 typedef int (*ttse_check_app_agreed_cb)(const char* appid, bool* is_agreed);
263 * @brief Called when the engine service user checks whether TTS engine needs the application's credential.
265 * @remarks This callback function is mandatory and must be registered using ttse_main().
266 * @return @c true if TTS engine needs the application's credential,
269 typedef bool (*ttse_need_app_credential_cb)(void);
273 * @brief Called when the engine service user starts to synthesize a voice, asynchronously.
275 * @remarks This callback function is mandatory and must be registered using ttse_main().
276 * In this callback function, TTS engine must transfer the synthesized result and @a user_data to the engine service user using ttse_send_result().
277 * Also, if TTS engine needs the application's credential, it can set the credential granted to the application.
278 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
279 * followed by ISO 639-1 for the two-letter language code.
280 * For example, "ko_KR" for Korean, "en_US" for American English
281 * @param[in] type The voice type
282 * @param[in] text Texts
283 * @param[in] speed The speed of speaking
284 * @param[in] appid The Application ID
285 * @param[in] credential The credential granted to the application
286 * @param[in] user_data The user data which must be passed to ttse_send_result()
287 * @return @c 0 on success,
288 * otherwise a negative error value
289 * @retval #TTSE_ERROR_NONE Successful
290 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
291 * @retval #TTSE_ERROR_INVALID_STATE Not initialized or already started synthesis
292 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
293 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
294 * @retval #TTSE_ERROR_NETWORK_DOWN Out of network
295 * @retval #TTSE_ERROR_PERMISSION_DENIED Permission denied
296 * @post This function invokes ttse_send_result().
297 * @see ttse_send_result()
298 * @see ttse_cancel_synthesis_cb()
299 * @see ttse_need_app_credential_cb()
301 typedef int (*ttse_start_synthesis_cb)(const char* language, int type, const char* text, int speed, const char* appid, const char* credential, void* user_data);
305 * @brief Called when the engine service user cancels to synthesize a voice.
307 * @remarks This callback function is mandatory and must be registered using ttse_main().
308 * @return @c 0 on success,
309 * otherwise a negative error value
310 * @retval #TTSE_ERROR_NONE Successful
311 * @retval #TTSE_ERROR_INVALID_STATE Not initialized or not started synthesis
312 * @pre The ttse_start_synthesis_cb() should be performed
313 * @see ttse_start_synthesis_cb()
315 typedef int (*ttse_cancel_synthesis_cb)(void);
319 * @brief Called when the engine service user requests the basic information of TTS engine.
321 * @remarks This callback function is mandatory and must be registered using ttse_main().
322 * The allocated @a engine_uuid, @a engine_name, and @a engine_setting will be released internally.
323 * In order to upload the engine at Tizen Appstore, both a service app and a ui app are necessary.
324 * Therefore, @a engine_setting must be transferred to the engine service user.
325 * @param[out] engine_uuid UUID of engine
326 * @param[out] engine_name Name of engine
327 * @param[out] engine_setting The engine setting application(ui app)'s app ID
328 * @param[out] use_network The status for using network
329 * @return @c 0 on success,
330 * otherwise a negative error code on failure
331 * @retval #TTSE_ERROR_NONE Successful
332 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
333 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
335 typedef int (*ttse_get_info_cb)(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
339 * @brief Called when TTS engine receives the private data from the engine service user.
340 * @details This callback function is called when the engine service user sends the private data to TTS engine.
342 * @remarks This callback function is optional and is registered using ttse_set_private_data_set_cb().
343 * @param[in] key The key field of private data
344 * @param[in] data The data field of private data
345 * @return @c 0 on success,
346 * otherwise a negative error value
347 * @retval #TTSE_ERROR_NONE Successful
348 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
349 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
350 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
351 * @see ttse_private_data_requested_cb()
352 * @see ttse_set_private_data_set_cb()
354 typedef int (*ttse_private_data_set_cb)(const char* key, const char* data);
358 * @brief Called when TTS engine provides the engine service user with the private data.
359 * @details This callback function is called when the engine service user gets the private data from TTS engine.
361 * @remarks This callback function is optional and is registered using ttse_set_private_data_requested_cb().
362 * @param[out] key The key field of private data
363 * @param[out] data The data field of private data
364 * @return @c 0 on success,
365 * otherwise a negative error value
366 * @retval #TTSE_ERROR_NONE Successful
367 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
369 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
370 * @see ttse_private_data_set_cb()
371 * @see ttse_set_private_data_requested_cb()
373 typedef int (*ttse_private_data_requested_cb)(const char* key, char** data);
377 * @brief A structure for the TTS engine functions.
378 * @details This structure contains essential callback functions for operating TTS engine.
380 * @remarks These functions are mandatory for operating TTS engine. Therefore, all functions MUST be implemented.
383 int version; /**< The version of the structure 'ttse_request_callback_s' */
384 ttse_get_info_cb get_info; /**< Called when the engine service user requests the basic information of TTS engine */
386 ttse_initialize_cb initialize; /**< Called when the engine service user initializes TTS engine */
387 ttse_deinitialize_cb deinitialize; /**< Called when the engine service user deinitializes TTS engine */
389 ttse_foreach_supported_voices_cb foreach_voices; /**< Called when the engine service user gets the whole supported voice list */
390 ttse_is_valid_voice_cb is_valid_voice; /**< Called when the engine service user checks whether the voice is valid or not in TTS engine */
391 ttse_set_pitch_cb set_pitch; /**< Called when the engine service user sets the default pitch of TTS engine */
393 ttse_load_voice_cb load_voice; /**< Called when the engine service user requests to load the corresponding voice type for the first time */
394 ttse_unload_voice_cb unload_voice; /**< Called when the engine service user requests to unload the corresponding voice type or to stop using voice */
396 ttse_start_synthesis_cb start_synth; /**< Called when the engine service user starts to synthesize a voice, asynchronously */
397 ttse_cancel_synthesis_cb cancel_synth; /**< Called when the engine service user cancels to synthesize a voice */
399 ttse_check_app_agreed_cb check_app_agreed; /**< Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine */
400 ttse_need_app_credential_cb need_app_credential; /**< Called when the engine service user checks whether TTS engine needs the application's credential */
401 } ttse_request_callback_s;
405 * @brief Main function for Text-To-Speech (TTS) engine.
406 * @details This function is the main function for operating TTS engine.
408 * @remarks The service_app_main() should be used for working the engine after this function.
409 * @param[in] argc The argument count(original)
410 * @param[in] argv The argument(original)
411 * @param[in] callback The structure of engine request callback function
412 * @return This function returns zero on success,
413 * or negative with error code on failure
414 * @retval #TTSE_ERROR_NONE Successful
415 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
416 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
417 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
418 * @see ttse_request_callback_s
422 // Required callback functions - MUST BE IMPLEMENTED
423 static int ttsengine_get_info_cb(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
424 static int ttsengine_initialize_cb(void);
425 static int ttsengine_deinitialize_cb(void);
426 static int ttsengine_is_valid_voice_cb(const char* language, int type, bool* is_valid);
427 static int ttsengine_foreach_supported_voices_cb(ttse_supported_voice_cb callback, void* user_data);
428 static int ttsengine_set_pitch_cb(int pitch);
429 static int ttsengine_load_voice_cb(const char* language, int type);
430 static int ttsengine_unload_voice_cb(const char* language, int type);
431 static int ttsengine_start_synthesis_cb(const char* language, int type, const char* text, int speed, void* user_data);
432 static int ttsengine_cancel_synthesis_cb(void);
433 static int ttsengine_check_app_agreed_cb(const char* appid, bool* is_agreed);
434 static bool ttsengine_need_app_credential_cb(void);
436 // Optional callback function
437 static int ttsengine_private_data_set_cb(const char* key, const char* data);
439 int main(int argc, char* argv[])
441 // 1. Create a structure 'ttse_request_callback_s'
442 ttse_request_callback_s engine_callback = { 0, };
444 engine_callback.size = sizeof(ttse_request_callback_s);
445 engine_callback.version = 1;
446 engine_callback.get_info = ttsengine_get_info_cb;
447 engine_callback.initialize = ttsengine_initialize_cb;
448 engine_callback.deinitialize = ttsengine_deinitialize_cb;
449 engine_callback.foreach_voices = ttsengine_foreach_supported_voices_cb;
450 engine_callback.is_valid_voice = ttsengine_is_valid_voice_cb;
451 engine_callback.set_pitch = ttsengine_set_pitch_cb;
452 engine_callback.load_voice = ttsengine_load_voice_cb;
453 engine_callback.unload_voice = ttsengine_unload_voice_cb;
454 engine_callback.start_synth = ttsengine_start_synthesis_cb;
455 engine_callback.cancel_synth = ttsengine_cancel_synthesis_cb;
456 engine_callback.check_app_agreed = ttsengine_check_app_agreed_cb;
457 engine_callback.need_app_credential = ttsengine_need_app_credential_cb;
459 // 2. Run 'ttse_main()'
460 if (0 != ttse_main(argc, argv, &engine_callback)) {
465 ttse_set_private_data_set_cb(ttsengine_private_data_set_cb);
467 // 3. Set event callbacks for service app and Run 'service_app_main()'
468 char ad[50] = { 0, };
470 service_app_lifecycle_callback_s event_callback;
471 app_event_handler_h handlers[5] = { NULL, };
473 event_callback.create = service_app_create;
474 event_callback.terminate = service_app_terminate;
475 event_callback.app_control = service_app_control;
477 service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
478 service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
479 service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
480 service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
482 return service_app_main(argc, argv, &event_callback, ad);
487 int ttse_main(int argc, char** argv, ttse_request_callback_s *callback);
491 * @brief Gets the speed range from Tizen platform.
493 * @remarks This API is used when TTS engine wants to get the speed range from Tizen platform.
494 * @param[out] min The minimum speed value
495 * @param[out] normal The normal speed value
496 * @param[out] max The maximum speed value
497 * @return @c 0 on success,
498 * otherwise a negative error value
499 * @retval #TTSE_ERROR_NONE Successful
500 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
501 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
502 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
504 int ttse_get_speed_range(int* min, int* normal, int* max);
508 * @brief Gets the pitch range from Tizen platform.
510 * @remarks This API is used when TTS engine wants to get the pitch range from Tizen platform.
511 * @param[out] min The minimum pitch value
512 * @param[out] normal The normal pitch value
513 * @param[out] max The maximum pitch value
514 * @return @c 0 on success,
515 * otherwise a negative error value
516 * @retval #TTSE_ERROR_NONE Successful
517 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
518 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
519 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
521 int ttse_get_pitch_range(int* min, int* normal, int* max);
525 * @brief Sends the synthesized result to the engine service user.
527 * @remarks This API is used in ttse_start_synthesis_cb(), when TTS engine sends the synthesized result to the engine service user.
528 * The synthesized result and @a user_data must be transferred to the engine service user through this function.
529 * @param[in] event The result event
530 * @param[in] data Result data
531 * @param[in] data_size Result data size
532 * @param[in] audio_type The audio type
533 * @param[in] rate The sample rate
534 * @param[in] user_data The user data passed from ttse_start_synthesis_cb()
535 * @return @c 0 on success,
536 * otherwise a negative error value
537 * @retval #TTSE_ERROR_NONE Successful
538 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
539 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
540 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
541 * @pre The ttse_main() function should be invoked before this function is called.
542 * ttse_start_synthesis_cb() will invoke this function.
543 * @see ttse_start_synthesis_cb()
545 int ttse_send_result(ttse_result_event_e event, const void* data, unsigned int data_size,
546 ttse_audio_type_e audio_type, int rate, void* user_data);
550 * @brief Sends the error to the engine service user.
551 * @details The following error codes can be delivered.
553 * #TTSE_ERROR_OUT_OF_MEMORY,
554 * #TTSE_ERROR_IO_ERROR,
555 * #TTSE_ERROR_INVALID_PARAMETER,
556 * #TTSE_ERROR_NETWORK_DOWN,
557 * #TTSE_ERROR_PERMISSION_DENIED,
558 * #TTSE_ERROR_INVALID_STATE,
559 * #TTSE_ERROR_INVALID_VOICE,
560 * #TTSE_ERROR_OPERATION_FAILED,
561 * #TTSE_ERROR_NOT_SUPPORTED_FEATURE,
562 * #TTSE_ERROR_NOT_SUPPORTED.
564 * @param[in] error The error reason
565 * @param[in] msg The error message
566 * @return @c 0 on success,
567 * otherwise a negative error value
568 * @retval #TTSE_ERROR_NONE Successful
569 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
570 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
571 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
572 * @pre The ttse_main() function should be invoked before this function is called.
574 int ttse_send_error(ttse_error_e error, const char* msg);
578 * @brief Sets a callback function for setting the private data.
580 * @remarks The ttse_private_data_set_cb() function is called when the engine service user sends the private data.
581 * @param[in] callback_func ttse_private_data_set event callback function
582 * @return @c 0 on success,
583 * otherwise a negative error value
584 * @retval #TTSE_ERROR_NONE Successful
585 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
586 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
587 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
588 * @pre The ttse_main() function should be invoked before this function is called.
589 * @see ttse_private_data_set_cb()
591 int ttse_set_private_data_set_cb(ttse_private_data_set_cb callback_func);
595 * @brief Sets a callback function for requesting the private data.
597 * @remarks The ttse_private_data_requested_cb() function is called when the engine service user gets the private data from TTS engine.
598 * @param[in] callback_func ttse_private_data_requested event callback function
599 * @return @c 0 on success,
600 * otherwise a negative error value
601 * @retval #TTSE_ERROR_NONE Successful
602 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
603 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
604 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
605 * @pre The ttse_main() function should be invoked before this function is called.
606 * @see ttse_private_data_requested_cb()
608 int ttse_set_private_data_requested_cb(ttse_private_data_requested_cb callback_func);
621 #endif /* __TTSE_H__ */