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.
21 * @addtogroup CAPI_UIX_TTSE_MODULE
30 * @brief Enumerations for error codes.
34 TTSE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
35 TTSE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
36 TTSE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
37 TTSE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
38 TTSE_ERROR_NETWORK_DOWN = TIZEN_ERROR_NETWORK_DOWN, /**< Out of network */
39 TTSE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
40 TTSE_ERROR_INVALID_STATE = TIZEN_ERROR_TTS | 0x01, /**< Invalid state */
41 TTSE_ERROR_INVALID_VOICE = TIZEN_ERROR_TTS | 0x02, /**< Invalid voice */
42 TTSE_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
43 TTSE_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature */
44 TTSE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported */
48 * @brief Enumerations for audio type.
52 TTSE_AUDIO_TYPE_RAW_S16 = 0, /**< Signed 16-bit audio type */
53 TTSE_AUDIO_TYPE_RAW_U8, /**< Unsigned 8-bit audio type */
58 * @brief Enumerations for result event type.
62 TTSE_RESULT_EVENT_FAIL = -1, /**< Event when the voice synthesis is failed */
63 TTSE_RESULT_EVENT_START = 1, /**< Event when the sound data is first data by callback function */
64 TTSE_RESULT_EVENT_CONTINUE = 2, /**< Event when the next sound data exist, not first and not last */
65 TTSE_RESULT_EVENT_FINISH = 3 /**< Event when the sound data is last data or sound data is only one result */
66 } ttse_result_event_e;
69 * @brief Definitions for male voice type.
72 #define TTSE_VOICE_TYPE_MALE 1
75 * @brief Definitions for female voice type.
78 #define TTSE_VOICE_TYPE_FEMALE 2
81 * @brief Definitions for child's voice type.
84 #define TTSE_VOICE_TYPE_CHILD 3
88 * @brief Called when TTS engine informs the engine service user about whole supported language and voice type list.
89 * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
92 * @remarks This callback function is called by ttse_foreach_supported_voices_cb() to inform the whole supported voice list.
93 * @a user_data must be transferred from ttse_foreach_supported_voices_cb().
95 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
96 * followed by ISO 639-1 for the two-letter language code. \n
97 * For example, "ko_KR" for Korean, "en_US" for American English.
98 * @param[in] type The voice type
99 * @param[in] user_data The user data passed from ttse_foreach_supported_voices_cb()
101 * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop
103 * @pre ttse_foreach_supported_voices_cb() will invoke this callback function.
105 * @see ttse_foreach_supported_voices_cb()
107 typedef bool (*ttse_supported_voice_cb)(const char* language, int type, void* user_data);
110 * @brief Called when the engine service user initializes TTS engine.
113 * @remarks This callback function is mandatory and must be registered using ttse_main().
115 * @return 0 on success, otherwise a negative error value
116 * @retval #TTSE_ERROR_NONE Successful
117 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
118 * @retval #TTSE_ERROR_INVALID_STATE Already initialized
119 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
120 * @retval #TTSE_ERROR_PERMISSION_DENIED Permission denied
122 * @see ttse_deinitialize_cb()
124 typedef int (*ttse_initialize_cb)(void);
127 * @brief Called when the engine service user deinitializes TTS engine.
130 * @remarks This callback function is mandatory and must be registered using ttse_main().
131 * NOTE that the engine may be terminated automatically.
132 * When this callback function is invoked, the release of resources is necessary.
134 * @return 0 on success, otherwise a negative error value
135 * @retval #TTSE_ERROR_NONE Successful
136 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
138 * @see ttse_initialize_cb()
140 typedef int (*ttse_deinitialize_cb)(void);
143 * @brief Called when the engine service user gets the whole supported voice list.
146 * @remarks This callback function is mandatory and must be registered using ttse_main().
147 * 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()'.
148 * 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()
154 * @return 0 on success, 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
159 * @post This callback function invokes ttse_supported_voice_cb() repeatedly for getting all supported voices.
161 * @see ttse_supported_voice_cb()
163 typedef int (*ttse_foreach_supported_voices_cb)(ttse_supported_voice_cb callback, void* user_data);
166 * @brief Called when the engine service user checks whether the voice is valid or not in TTS engine.
169 * @remarks This callback function is mandatory and must be registered using ttse_main().
171 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
172 * followed by ISO 639-1 for the two-letter language code. \n
173 * For example, "ko_KR" for Korean, "en_US" for American English.
174 * @param[in] type The voice type
175 * @param[out] is_valid A variable for checking whether the corresponding voice is valid or not. \n @c true to be valid, @c false to be invalid.
177 * @return 0 on success, otherwise a negative error value
178 * @retval #TTSE_ERROR_NONE Successful
179 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
181 * @see ttse_foreach_supported_voices_cb()
183 typedef int (*ttse_is_valid_voice_cb)(const char* language, int type, bool* is_valid);
186 * @brief Called when the engine service user sets the default pitch of TTS engine.
189 * @remarks This callback function is mandatory and must be registered using ttse_main().
191 * @param[in] pitch The default pitch
193 * @return 0 on success, otherwise a negative error value
194 * @retval #TTSE_ERROR_NONE Successful
195 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
197 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
199 typedef int (*ttse_set_pitch_cb)(int pitch);
202 * @brief Called when the engine service user requests to load the corresponding voice type for the first time.
205 * @remarks This callback function is mandatory and must be registered using ttse_main().
207 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
208 * followed by ISO 639-1 for the two-letter language code. \n
209 * For example, "ko_KR" for Korean, "en_US" for American English.
210 * @param[in] type The voice type
212 * @return 0 on success, otherwise a negative error value
213 * @retval #TTSE_ERROR_NONE Successful
214 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
215 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
216 * @retval #TTSE_ERROR_OUT_OF_MEMORY Out of memory
217 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
218 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
220 * @see ttse_unload_voice_cb()
222 typedef int (*ttse_load_voice_cb)(const char* language, int type);
225 * @brief Called when the engine service user requests to unload the corresponding voice type or to stop using voice.
228 * @remarks This callback function is mandatory and must be registered using ttse_main().
230 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
231 * followed by ISO 639-1 for the two-letter language code. \n
232 * For example, "ko_KR" for Korean, "en_US" for American English.
233 * @param[in] type The voice type
235 * @return 0 on success, otherwise a negative error value
236 * @retval #TTSE_ERROR_NONE Successful
237 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
238 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
239 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
240 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
242 * @see ttse_load_voice_cb()
244 typedef int (*ttse_unload_voice_cb)(const char* language, int type);
247 * @brief Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine.
248 * @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.
249 * According to the need, the engine developer can provide some user interfaces to check the agreement.
252 * @remarks This callback function is mandatory and must be registered using ttse_main().
253 * 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. \n @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.
254 * 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.
256 * @param[in] appid The Application ID
257 * @param[out] is_agreed A variable for checking whether the application agreed to use TTS engine or not. \n @c true to agree, @c false to disagree.
259 * @return 0 on success, otherwise a negative error value
260 * @retval #TTSE_ERROR_NONE Successful
261 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
262 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
263 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
265 typedef int (*ttse_check_app_agreed_cb)(const char* appid, bool* is_agreed);
268 * @brief Called when the engine service user checks whether TTS engine needs the application's credential.
271 * @remarks This callback function is mandatory and must be registered using ttse_main().
273 * @return @c true if TTS engine needs the application's credential, otherwise @c false
275 typedef bool (*ttse_need_app_credential_cb)(void);
278 * @brief Called when the engine service user starts to synthesize a voice, asynchronously.
281 * @remarks This callback function is mandatory and must be registered using ttse_main().
282 * In this callback function, TTS engine must transfer the synthesized result and @a user_data to the engine service user using ttse_send_result().
283 * Also, if TTS engine needs the application's credential, it can set the credential granted to the application.
285 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
286 * followed by ISO 639-1 for the two-letter language code. \n
287 * For example, "ko_KR" for Korean, "en_US" for American English.
288 * @param[in] type The voice type
289 * @param[in] text Texts
290 * @param[in] speed The speed of speaking
291 * @param[in] appid The Application ID
292 * @param[in] credential The credential granted to the application
293 * @param[in] user_data The user data which must be passed to ttse_send_result()
295 * @return 0 on success, otherwise a negative error value
296 * @retval #TTSE_ERROR_NONE Successful
297 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
298 * @retval #TTSE_ERROR_INVALID_STATE Not initialized or already started synthesis
299 * @retval #TTSE_ERROR_INVALID_VOICE Invalid voice
300 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
301 * @retval #TTSE_ERROR_NETWORK_DOWN Out of network
302 * @retval #TTSE_ERROR_PERMISSION_DENIED Permission denied
304 * @post This function invokes ttse_send_result().
306 * @see ttse_send_result()
307 * @see ttse_cancel_synthesis_cb()
308 * @see ttse_need_app_credential_cb()
310 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);
313 * @brief Called when the engine service user cancels to synthesize a voice.
316 * @remarks This callback function is mandatory and must be registered using ttse_main().
318 * @return 0 on success, otherwise a negative error value
319 * @retval #TTSE_ERROR_NONE Successful
320 * @retval #TTSE_ERROR_INVALID_STATE Not initialized or not started synthesis
322 * @pre The ttse_start_synthesis_cb() should be performed
324 * @see ttse_start_synthesis_cb()
326 typedef int (*ttse_cancel_synthesis_cb)(void);
329 * @brief Called when the engine service user requests the basic information of TTS engine.
332 * @remarks This callback function is mandatory and must be registered using ttse_main().
333 * The allocated @a engine_uuid, @a engine_name, and @a engine_setting will be released internally.
334 * In order to upload the engine at Tizen Appstore, both a service app and a ui app are necessary.
335 * Therefore, @a engine_setting must be transferred to the engine service user.
337 * @param[out] engine_uuid UUID of engine
338 * @param[out] engine_name Name of engine
339 * @param[out] engine_setting The engine setting application(ui app)'s app id
340 * @param[out] use_network The status for using network
342 * @return 0 on success, otherwise a negative error code on failure
343 * @retval #TTSE_ERROR_NONE Successful
344 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
345 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
348 typedef int (*ttse_get_info_cb)(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
351 * @brief Called when TTS engine receives the private data from the engine service user.
352 * @details This callback function is called when the engine service user sends the private data to TTS engine.
355 * @remarks This callback function is optional and is registered using ttse_set_private_data_set_cb().
357 * @param[in] key The key field of private data.
358 * @param[in] data The data field of private data.
360 * @return 0 on success, otherwise a negative error value
361 * @retval #TTSE_ERROR_NONE Successful
362 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
363 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
364 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
366 * @see ttse_private_data_requested_cb()
367 * @see ttse_set_private_data_set_cb()
369 typedef int (*ttse_private_data_set_cb)(const char* key, const char* data);
372 * @brief Called when TTS engine provides the engine service user with the private data.
373 * @details This callback function is called when the engine service user gets the private data from TTS engine.
376 * @remarks This callback function is optional and is registered using ttse_set_private_data_requested_cb().
378 * @param[out] key The key field of private data.
379 * @param[out] data The data field of private data.
381 * @return 0 on success, otherwise a negative error value
382 * @retval #TTSE_ERROR_NONE Successful
383 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
384 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
385 * @retval #TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
387 * @see ttse_private_data_set_cb()
388 * @see ttse_set_private_data_requested_cb()
390 typedef int (*ttse_private_data_requested_cb)(const char* key, char** data);
394 * @brief A structure for the TTS engine functions.
395 * @details This structure contains essential callback functions for operating TTS engine.
398 * @remarks These functions are mandatory for operating TTS engine. Therefore, all functions MUST be implemented.
401 int version; /**< The version of the structure 'ttse_request_callback_s' */
402 ttse_get_info_cb get_info; /**< Called when the engine service user requests the basic information of TTS engine */
404 ttse_initialize_cb initialize; /**< Called when the engine service user initializes TTS engine */
405 ttse_deinitialize_cb deinitialize; /**< Called when the engine service user deinitializes TTS engine */
407 ttse_foreach_supported_voices_cb foreach_voices; /**< Called when the engine service user gets the whole supported voice list */
408 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 */
409 ttse_set_pitch_cb set_pitch; /**< Called when the engine service user sets the default pitch of TTS engine */
411 ttse_load_voice_cb load_voice; /**< Called when the engine service user requests to load the corresponding voice type for the first time */
412 ttse_unload_voice_cb unload_voice; /**< Called when the engine service user requests to unload the corresponding voice type or to stop using voice */
414 ttse_start_synthesis_cb start_synth; /**< Called when the engine service user starts to synthesize a voice, asynchronously */
415 ttse_cancel_synthesis_cb cancel_synth; /**< Called when the engine service user cancels to synthesize a voice */
417 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 */
418 ttse_need_app_credential_cb need_app_credential; /**< Called when the engine service user checks whether TTS engine needs the application's credential */
419 } ttse_request_callback_s;
422 * @brief Main function for Text-To-Speech (TTS) engine.
423 * @details This function is the main function for operating TTS engine.
427 * @remarks The service_app_main() should be used for working the engine after this function.
429 * @param[in] argc The argument count(original)
430 * @param[in] argv The argument(original)
431 * @param[in] callback The structure of engine request callback function
433 * @return This function returns zero on success, or negative with error code on failure
434 * @retval #TTSE_ERROR_NONE Successful
435 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
436 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
437 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
439 * @see ttse_request_callback_s
444 // Required callback functions - MUST BE IMPLEMENTED
445 static int ttsengine_get_info_cb(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network);
446 static int ttsengine_initialize_cb(void);
447 static int ttsengine_deinitialize_cb(void);
448 static int ttsengine_is_valid_voice_cb(const char* language, int type, bool* is_valid);
449 static int ttsengine_foreach_supported_voices_cb(ttse_supported_voice_cb callback, void* user_data);
450 static int ttsengine_set_pitch_cb(int pitch);
451 static int ttsengine_load_voice_cb(const char* language, int type);
452 static int ttsengine_unload_voice_cb(const char* language, int type);
453 static int ttsengine_start_synthesis_cb(const char* language, int type, const char* text, int speed, void* user_data);
454 static int ttsengine_cancel_synthesis_cb(void);
455 static int ttsengine_check_app_agreed_cb(const char* appid, bool* is_agreed);
456 static bool ttsengine_need_app_credential_cb(void);
458 // Optional callback function
459 static int ttsengine_private_data_set_cb(const char* key, const char* data);
461 int main(int argc, char* argv[])
463 // 1. Create a structure 'ttse_request_callback_s'
464 ttse_request_callback_s engine_callback = { 0, };
466 engine_callback.size = sizeof(ttse_request_callback_s);
467 engine_callback.version = 1;
468 engine_callback.get_info = ttsengine_get_info_cb;
469 engine_callback.initialize = ttsengine_initialize_cb;
470 engine_callback.deinitialize = ttsengine_deinitialize_cb;
471 engine_callback.foreach_voices = ttsengine_foreach_supported_voices_cb;
472 engine_callback.is_valid_voice = ttsengine_is_valid_voice_cb;
473 engine_callback.set_pitch = ttsengine_set_pitch_cb;
474 engine_callback.load_voice = ttsengine_load_voice_cb;
475 engine_callback.unload_voice = ttsengine_unload_voice_cb;
476 engine_callback.start_synth = ttsengine_start_synthesis_cb;
477 engine_callback.cancel_synth = ttsengine_cancel_synthesis_cb;
478 engine_callback.check_app_agreed = ttsengine_check_app_agreed_cb;
479 engine_callback.need_app_credential = ttsengine_need_app_credential_cb;
481 // 2. Run 'ttse_main()'
482 if (0 != ttse_main(argc, argv, &engine_callback)) {
487 ttse_set_private_data_set_cb(ttsengine_private_data_set_cb);
489 // 3. Set event callbacks for service app and Run 'service_app_main()'
490 char ad[50] = { 0, };
492 service_app_lifecycle_callback_s event_callback;
493 app_event_handler_h handlers[5] = { NULL, };
495 event_callback.create = service_app_create;
496 event_callback.terminate = service_app_terminate;
497 event_callback.app_control = service_app_control;
499 service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
500 service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
501 service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
502 service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
504 return service_app_main(argc, argv, &event_callback, ad);
509 int ttse_main(int argc, char** argv, ttse_request_callback_s *callback);
512 * @brief Gets the speed range from Tizen platform.
515 * @remarks This API is used when TTS engine wants to get the speed range from Tizen platform.
517 * @param[out] min The minimum speed value
518 * @param[out] normal The normal speed value
519 * @param[out] max The maximum speed value
521 * @return 0 on success, otherwise a negative error value
522 * @retval #TTSE_ERROR_NONE Successful
523 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
524 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
525 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
528 int ttse_get_speed_range(int* min, int* normal, int* max);
531 * @brief Gets the pitch range from Tizen platform.
534 * @remarks This API is used when TTS engine wants to get the pitch range from Tizen platform.
536 * @param[out] min The minimum pitch value
537 * @param[out] normal The normal pitch value
538 * @param[out] max The maximum pitch value
540 * @return 0 on success, otherwise a negative error value
541 * @retval #TTSE_ERROR_NONE Successful
542 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
543 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
544 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
547 int ttse_get_pitch_range(int* min, int* normal, int* max);
550 * @brief Sends the synthesized result to the engine service user.
553 * @remarks This API is used in ttse_start_synthesis_cb(), when TTS engine sends the synthesized result to the engine service user.
554 * The synthesized result and @a user_data must be transferred to the engine service user through this function.
556 * @param[in] event The result event
557 * @param[in] data Result data
558 * @param[in] data_size Result data size
559 * @param[in] audio_type The audio type
560 * @param[in] rate The sample rate
561 * @param[in] user_data The user data passed from ttse_start_synthesis_cb()
563 * @return 0 on success, otherwise a negative error value
564 * @retval #TTSE_ERROR_NONE Successful
565 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
566 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
567 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
569 * @pre The ttse_main() function should be invoked before this function is called.
570 * ttse_start_synthesis_cb() will invoke this function.
572 * @see ttse_start_synthesis_cb()
574 int ttse_send_result(ttse_result_event_e event, const void* data, unsigned int data_size,
575 ttse_audio_type_e audio_type, int rate, void* user_data);
578 * @brief Sends the error to the engine service user.
579 * @details The following error codes can be delivered.\n
580 * #TTSE_ERROR_NONE,\n
581 * #TTSE_ERROR_OUT_OF_MEMORY,\n
582 * #TTSE_ERROR_IO_ERROR,\n
583 * #TTSE_ERROR_INVALID_PARAMETER,\n
584 * #TTSE_ERROR_NETWORK_DOWN,\n
585 * #TTSE_ERROR_PERMISSION_DENIED,\n
586 * #TTSE_ERROR_INVALID_STATE,\n
587 * #TTSE_ERROR_INVALID_VOICE,\n
588 * #TTSE_ERROR_OPERATION_FAILED,\n
589 * #TTSE_ERROR_NOT_SUPPORTED_FEATURE,\n
590 * #TTSE_ERROR_NOT_SUPPORTED.\n
594 * @param[in] error The error reason
595 * @param[in] msg The error message
597 * @return 0 on success, otherwise a negative error value
598 * @retval #TTSE_ERROR_NONE Successful
599 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
600 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
601 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
603 * @pre The ttse_main() function should be invoked before this function is called.
605 int ttse_send_error(ttse_error_e error, const char* msg);
608 * @brief Sets a callback function for setting the private data.
611 * @remarks The ttse_private_data_set_cb() function is called when the engine service user sends the private data.
613 * @param[in] callback_func ttse_private_data_set event callback function
615 * @return 0 on success, otherwise a negative error value
616 * @retval #TTSE_ERROR_NONE Successful
617 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
618 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
619 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
621 * @pre The ttse_main() function should be invoked before this function is called.
623 * @see ttse_private_data_set_cb()
625 int ttse_set_private_data_set_cb(ttse_private_data_set_cb callback_func);
628 * @brief Sets a callback function for requesting the private data.
631 * @remarks The ttse_private_data_requested_cb() function is called when the engine service user gets the private data from TTS engine.
633 * @param[in] callback_func ttse_private_data_requested event callback function
635 * @return 0 on success, otherwise a negative error value
636 * @retval #TTSE_ERROR_NONE Successful
637 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
638 * @retval #TTSE_ERROR_NOT_SUPPORTED Not supported
639 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
641 * @pre The ttse_main() function should be invoked before this function is called.
643 * @see ttse_private_data_requested_cb()
645 int ttse_set_private_data_requested_cb(ttse_private_data_requested_cb callback_func);
657 #endif /* __TTSE_H__ */