Tizen(Headed) Native API
6.5
|
The TTS Engine APIs provide functions to operate Text-To-Speech Engine.
Required Header
#include <ttse.h>
Overview
Text-To-Speech Engine (below TTSE) is an engine for synthesizing voice from text and playing synthesized sound data. Using the TTS Engine APIs, TTSE developers can provide TTSE service users, who want to apply TTSE, with functions necessary to operate the engine. According to the indispensability of TTSE services, there are two ways to provide them to the users.
A. Required TTSE services
These services are indispensable to operate TTSE. Therefore, the TTSE developers MUST implement callback functions corresponding to the required TTSE services. The following is a list of the callback functions.
FUNCTION | DESCRIPTION |
---|---|
ttse_get_info_cb() | Called when the engine service user requests the basic information of TTS engine. |
ttse_initialize_cb() | Called when the engine service user initializes TTS engine. |
ttse_deinitialize_cb() | Called when the engine service user deinitializes TTS engine. |
ttse_is_valid_voice_cb() | Called when the engine service user checks whether the voice is valid or not in TTS engine. |
ttse_foreach_supported_voices_cb() | Called when the engine service user gets the whole supported voice list. |
ttse_set_pitch_cb() | Called when the engine service user sets the default pitch of TTS engine. |
ttse_load_voice_cb() | Called when the engine service user requests to load the corresponding voice type for the first time. |
ttse_unload_voice_cb() | Called when the engine service user requests to unload the corresponding voice type or to stop using voice. |
ttse_start_synthesis_cb() | Called when the engine service user starts to synthesize a voice, asynchronously. |
ttse_cancel_synthesis_cb() | Called when the engine service user cancels to synthesize a voice. |
ttse_check_app_agreed_cb() | Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine. |
ttse_need_app_credential_cb() | Called when the engine service user checks whether TTS engine needs the application's credential. |
The TTSE developers can register the above callback functions at a time with using a structure 'ttse_request_callback_s' and an API 'ttse_main()'. To operate TTSE, the following steps should be used:
1. Create a structure 'ttse_request_callback_s' 2. Implement callback functions. (NOTE that the callback functions should return appropriate values in accordance with the instruction. If the callback function returns an unstated value, TTS framework will handle it as TTSE_ERROR_OPERATION_FAILED.)
3. Register callback functions using 'ttse_main()'. (The registered callback functions will be invoked when the TTSE service users request the TTSE services.)
4. Use 'service_app_main()' for working TTSE.
B. Optional TTSE services
Unlike the required TTSE services, these services are optional to operate TTSE. The followings are optional TTSE services.
- receive/provide the private data
If the TTSE developers want to provide the above services, use the following APIs and implement the corresponding callback functions:
FUNCTION DESCRIPTION CORRESPONDING CALLBACK ttse_set_private_data_set_cb() Sets a callback function for receiving the private data from the engine service user. ttse_private_data_set_cb() ttse_set_private_data_requested_cb() Sets a callback function for providing the private data to the engine service user. ttse_private_data_requested_cb()
FUNCTION DESCRIPTION ttse_get_speed_range() Gets the speed range from Tizen platform. ttse_get_pitch_range() Gets the pitch range from Tizen platform. ttse_send_result() Sends the synthesized result to the engine service user. ttse_send_error() Sends the error to the engine service user.
Related Features
This API is related with the following features:
- http://tizen.org/feature/speech.synthesis
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | ttse_main (int argc, char **argv, ttse_request_callback_s *callback) |
Main function for Text-To-Speech (TTS) engine. | |
int | ttse_get_speed_range (int *min, int *normal, int *max) |
Gets the speed range from Tizen platform. | |
int | ttse_get_pitch_range (int *min, int *normal, int *max) |
Gets the pitch range from Tizen platform. | |
int | ttse_send_result (ttse_result_event_e event, const void *data, unsigned int data_size, ttse_audio_type_e audio_type, int rate, void *user_data) |
Sends the synthesized result to the engine service user. | |
int | ttse_send_error (ttse_error_e error, const char *msg) |
Sends the error to the engine service user. | |
int | ttse_set_private_data_set_cb (ttse_private_data_set_cb callback_func) |
Sets a callback function for setting the private data. | |
int | ttse_set_private_data_requested_cb (ttse_private_data_requested_cb callback_func) |
Sets a callback function for requesting the private data. | |
Typedefs | |
typedef bool(* | ttse_supported_voice_cb )(const char *language, int type, void *user_data) |
Called when TTS engine informs the engine service user about whole supported language and voice type list. | |
typedef int(* | ttse_initialize_cb )(void) |
Called when the engine service user initializes TTS engine. | |
typedef int(* | ttse_deinitialize_cb )(void) |
Called when the engine service user deinitializes TTS engine. | |
typedef int(* | ttse_foreach_supported_voices_cb )(ttse_supported_voice_cb callback, void *user_data) |
Called when the engine service user gets the whole supported voice list. | |
typedef int(* | ttse_is_valid_voice_cb )(const char *language, int type, bool *is_valid) |
Called when the engine service user checks whether the voice is valid or not in TTS engine. | |
typedef int(* | ttse_set_pitch_cb )(int pitch) |
Called when the engine service user sets the default pitch of TTS engine. | |
typedef int(* | ttse_load_voice_cb )(const char *language, int type) |
Called when the engine service user requests to load the corresponding voice type for the first time. | |
typedef int(* | ttse_unload_voice_cb )(const char *language, int type) |
Called when the engine service user requests to unload the corresponding voice type or to stop using voice. | |
typedef int(* | ttse_check_app_agreed_cb )(const char *appid, bool *is_agreed) |
Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine. | |
typedef bool(* | ttse_need_app_credential_cb )(void) |
Called when the engine service user checks whether TTS engine needs the application's credential. | |
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) |
Called when the engine service user starts to synthesize a voice, asynchronously. | |
typedef int(* | ttse_cancel_synthesis_cb )(void) |
Called when the engine service user cancels to synthesize a voice. | |
typedef int(* | ttse_get_info_cb )(char **engine_uuid, char **engine_name, char **engine_setting, bool *use_network) |
Called when the engine service user requests the basic information of TTS engine. | |
typedef int(* | ttse_private_data_set_cb )(const char *key, const char *data) |
Called when TTS engine receives the private data from the engine service user. | |
typedef int(* | ttse_private_data_requested_cb )(const char *key, char **data) |
Called when TTS engine provides the engine service user with the private data. | |
Defines | |
#define | TTSE_VOICE_TYPE_MALE 1 |
Definition for male voice type. | |
#define | TTSE_VOICE_TYPE_FEMALE 2 |
Definition for female voice type. | |
#define | TTSE_VOICE_TYPE_CHILD 3 |
Definition for child's voice type. |
Define Documentation
#define TTSE_VOICE_TYPE_CHILD 3 |
Definition for child's voice type.
- Since :
- 3.0
#define TTSE_VOICE_TYPE_FEMALE 2 |
Definition for female voice type.
- Since :
- 3.0
#define TTSE_VOICE_TYPE_MALE 1 |
Definition for male voice type.
- Since :
- 3.0
Typedef Documentation
typedef int(* ttse_cancel_synthesis_cb)(void) |
Called when the engine service user cancels to synthesize a voice.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_STATE Not initialized or not started synthesis
- Precondition:
- The ttse_start_synthesis_cb() should be performed
- See also:
- ttse_start_synthesis_cb()
typedef int(* ttse_check_app_agreed_cb)(const char *appid, bool *is_agreed) |
Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine.
This callback function is called when the engine service user requests for TTS engine to check the application's agreement about using the engine. According to the need, the engine developer can provide some user interfaces to check the agreement.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main(). If the TTS engine developer wants not to check the agreement, the developer has need to return proper values as is_agreed in accordance with the intention.
true
if the developer regards that every application agreed the usage of the engine,false
if the developer regards that every application disagreed. 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.
- Parameters:
-
[in] appid The Application ID [out] is_agreed A variable for checking whether the application agreed to use TTS engine or not. true
to agree,false
to disagree
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_STATE Not initialized TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
typedef int(* ttse_deinitialize_cb)(void) |
Called when the engine service user deinitializes TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main(). NOTE that the engine may be terminated automatically. When this callback function is invoked, the release of resources is necessary.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_STATE Not initialized
- See also:
- ttse_initialize_cb()
typedef int(* ttse_foreach_supported_voices_cb)(ttse_supported_voice_cb callback, void *user_data) |
Called when the engine service user gets the whole supported voice list.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main(). In this function, the engine service user's callback function 'ttse_supported_voice_cb()' is invoked repeatedly for getting all supported voices, and user_data must be transferred to 'ttse_supported_voice_cb()'. If 'ttse_supported_voice_cb()' returns
false
, it should be stopped to call 'ttse_supported_voice_cb()'.
- Parameters:
-
[in] callback The callback function [in] user_data The user data which must be passed to ttse_supported_voice_cb()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Not initialized
- Postcondition:
- This callback function invokes ttse_supported_voice_cb() repeatedly for getting all supported voices.
- See also:
- ttse_supported_voice_cb()
typedef int(* ttse_get_info_cb)(char **engine_uuid, char **engine_name, char **engine_setting, bool *use_network) |
Called when the engine service user requests the basic information of TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main(). The allocated engine_uuid, engine_name, and engine_setting will be released internally. In order to upload the engine at Tizen Appstore, both a service app and a ui app are necessary. Therefore, engine_setting must be transferred to the engine service user.
- Parameters:
-
[out] engine_uuid UUID of engine [out] engine_name Name of engine [out] engine_setting The engine setting application(ui app)'s app ID [out] use_network The status for using network
- Returns:
0
on success, otherwise a negative error code on failure
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_OPERATION_FAILED Operation failure
typedef int(* ttse_initialize_cb)(void) |
Called when the engine service user initializes TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Already initialized TTSE_ERROR_OPERATION_FAILED Operation failure TTSE_ERROR_PERMISSION_DENIED Permission denied
- See also:
- ttse_deinitialize_cb()
typedef int(* ttse_is_valid_voice_cb)(const char *language, int type, bool *is_valid) |
Called when the engine service user checks whether the voice is valid or not in TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Parameters:
-
[in] language The language is 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 [in] type The voice type [out] is_valid A variable for checking whether the corresponding voice is valid or not. true
to be valid,false
to be invalid
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- ttse_foreach_supported_voices_cb()
typedef int(* ttse_load_voice_cb)(const char *language, int type) |
Called when the engine service user requests to load the corresponding voice type for the first time.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Parameters:
-
[in] language The language is 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 [in] type The voice type
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Not initialized TTSE_ERROR_OUT_OF_MEMORY Out of memory TTSE_ERROR_INVALID_VOICE Invalid voice TTSE_ERROR_OPERATION_FAILED Operation failure
- See also:
- ttse_unload_voice_cb()
typedef bool(* ttse_need_app_credential_cb)(void) |
Called when the engine service user checks whether TTS engine needs the application's credential.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Returns:
true
if TTS engine needs the application's credential, otherwisefalse
typedef int(* ttse_private_data_requested_cb)(const char *key, char **data) |
Called when TTS engine provides the engine service user with the private data.
This callback function is called when the engine service user gets the private data from TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is optional and is registered using ttse_set_private_data_requested_cb().
- Parameters:
-
[out] key The key field of private data [out] data The data field of private data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_OPERATION_FAILED Operation failure TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
typedef int(* ttse_private_data_set_cb)(const char *key, const char *data) |
Called when TTS engine receives the private data from the engine service user.
This callback function is called when the engine service user sends the private data to TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is optional and is registered using ttse_set_private_data_set_cb().
- Parameters:
-
[in] key The key field of private data [in] data The data field of private data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_OPERATION_FAILED Operation failure TTSE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
typedef int(* ttse_set_pitch_cb)(int pitch) |
Called when the engine service user sets the default pitch of TTS engine.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Parameters:
-
[in] pitch The default pitch
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Not initialized TTSE_ERROR_OPERATION_FAILED Operation failure
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) |
Called when the engine service user starts to synthesize a voice, asynchronously.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main(). In this callback function, TTS engine must transfer the synthesized result and user_data to the engine service user using ttse_send_result(). Also, if TTS engine needs the application's credential, it can set the credential granted to the application.
- Parameters:
-
[in] language The language is 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 [in] type The voice type [in] text Texts [in] speed The speed of speaking [in] appid The Application ID [in] credential The credential granted to the application [in] user_data The user data which must be passed to ttse_send_result()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Not initialized or already started synthesis TTSE_ERROR_INVALID_VOICE Invalid voice TTSE_ERROR_OPERATION_FAILED Operation failure TTSE_ERROR_NETWORK_DOWN Out of network TTSE_ERROR_PERMISSION_DENIED Permission denied
- Postcondition:
- This function invokes ttse_send_result().
typedef bool(* ttse_supported_voice_cb)(const char *language, int type, void *user_data) |
Called when TTS engine informs the engine service user about whole supported language and voice type list.
This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
- Since :
- 3.0
- Remarks:
- This callback function is called by ttse_foreach_supported_voices_cb() to inform the whole supported voice list. user_data must be transferred from ttse_foreach_supported_voices_cb().
- Parameters:
-
[in] language The language is 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 [in] type The voice type [in] user_data The user data passed from ttse_foreach_supported_voices_cb()
- Returns:
true
to continue with the next iteration of the loopfalse
to break out of the loop
- Precondition:
- ttse_foreach_supported_voices_cb() will invoke this callback function.
- See also:
- ttse_foreach_supported_voices_cb()
typedef int(* ttse_unload_voice_cb)(const char *language, int type) |
Called when the engine service user requests to unload the corresponding voice type or to stop using voice.
- Since :
- 3.0
- Remarks:
- This callback function is mandatory and must be registered using ttse_main().
- Parameters:
-
[in] language The language is 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 [in] type The voice type
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_INVALID_STATE Not initialized TTSE_ERROR_INVALID_VOICE Invalid voice TTSE_ERROR_OPERATION_FAILED Operation failure
- See also:
- ttse_load_voice_cb()
Enumeration Type Documentation
enum ttse_audio_type_e |
enum ttse_error_e |
Enumeration for error codes.
- Since :
- 3.0
- Enumerator:
enum ttse_result_event_e |
Enumeration for result event type.
- Since :
- 3.0
- Enumerator:
Function Documentation
int ttse_get_pitch_range | ( | int * | min, |
int * | normal, | ||
int * | max | ||
) |
Gets the pitch range from Tizen platform.
- Since :
- 3.0
- Remarks:
- This API is used when TTS engine wants to get the pitch range from Tizen platform.
- Parameters:
-
[out] min The minimum pitch value [out] normal The normal pitch value [out] max The maximum pitch value
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
int ttse_get_speed_range | ( | int * | min, |
int * | normal, | ||
int * | max | ||
) |
Gets the speed range from Tizen platform.
- Since :
- 3.0
- Remarks:
- This API is used when TTS engine wants to get the speed range from Tizen platform.
- Parameters:
-
[out] min The minimum speed value [out] normal The normal speed value [out] max The maximum speed value
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
int ttse_main | ( | int | argc, |
char ** | argv, | ||
ttse_request_callback_s * | callback | ||
) |
Main function for Text-To-Speech (TTS) engine.
This function is the main function for operating TTS engine.
- Since :
- 3.0
- Remarks:
- The service_app_main() should be used for working the engine after this function.
- Parameters:
-
[in] argc The argument count(original) [in] argv The argument(original) [in] callback The structure of engine request callback function
- Returns:
- This function returns zero on success, or negative with error code on failure
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_OPERATION_FAILED Operation failure TTSE_ERROR_NOT_SUPPORTED Not supported
- See also:
- ttse_request_callback_s
#include <ttse.h> // Required callback functions - MUST BE IMPLEMENTED static int ttsengine_get_info_cb(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network); static int ttsengine_initialize_cb(void); static int ttsengine_deinitialize_cb(void); static int ttsengine_is_valid_voice_cb(const char* language, int type, bool* is_valid); static int ttsengine_foreach_supported_voices_cb(ttse_supported_voice_cb callback, void* user_data); static int ttsengine_set_pitch_cb(int pitch); static int ttsengine_load_voice_cb(const char* language, int type); static int ttsengine_unload_voice_cb(const char* language, int type); static int ttsengine_start_synthesis_cb(const char* language, int type, const char* text, int speed, void* user_data); static int ttsengine_cancel_synthesis_cb(void); static int ttsengine_check_app_agreed_cb(const char* appid, bool* is_agreed); static bool ttsengine_need_app_credential_cb(void); // Optional callback function static int ttsengine_private_data_set_cb(const char* key, const char* data); int main(int argc, char* argv[]) { // 1. Create a structure 'ttse_request_callback_s' ttse_request_callback_s engine_callback = { 0, }; engine_callback.size = sizeof(ttse_request_callback_s); engine_callback.version = 1; engine_callback.get_info = ttsengine_get_info_cb; engine_callback.initialize = ttsengine_initialize_cb; engine_callback.deinitialize = ttsengine_deinitialize_cb; engine_callback.foreach_voices = ttsengine_foreach_supported_voices_cb; engine_callback.is_valid_voice = ttsengine_is_valid_voice_cb; engine_callback.set_pitch = ttsengine_set_pitch_cb; engine_callback.load_voice = ttsengine_load_voice_cb; engine_callback.unload_voice = ttsengine_unload_voice_cb; engine_callback.start_synth = ttsengine_start_synthesis_cb; engine_callback.cancel_synth = ttsengine_cancel_synthesis_cb; engine_callback.check_app_agreed = ttsengine_check_app_agreed_cb; engine_callback.need_app_credential = ttsengine_need_app_credential_cb; // 2. Run 'ttse_main()' if (0 != ttse_main(argc, argv, &engine_callback)) { return -1; } // Optional ttse_set_private_data_set_cb(ttsengine_private_data_set_cb); // 3. Set event callbacks for service app and Run 'service_app_main()' char ad[50] = { 0, }; service_app_lifecycle_callback_s event_callback; app_event_handler_h handlers[5] = { NULL, }; event_callback.create = service_app_create; event_callback.terminate = service_app_terminate; event_callback.app_control = service_app_control; service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); return service_app_main(argc, argv, &event_callback, ad); }
int ttse_send_error | ( | ttse_error_e | error, |
const char * | msg | ||
) |
Sends the error to the engine service user.
The following error codes can be delivered. TTSE_ERROR_NONE, TTSE_ERROR_OUT_OF_MEMORY, TTSE_ERROR_IO_ERROR, TTSE_ERROR_INVALID_PARAMETER, TTSE_ERROR_NETWORK_DOWN, TTSE_ERROR_PERMISSION_DENIED, TTSE_ERROR_INVALID_STATE, TTSE_ERROR_INVALID_VOICE, TTSE_ERROR_OPERATION_FAILED, TTSE_ERROR_NOT_SUPPORTED_FEATURE, TTSE_ERROR_NOT_SUPPORTED.
- Since :
- 3.0
- Parameters:
-
[in] error The error reason [in] msg The error message
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
- Precondition:
- The ttse_main() function should be invoked before this function is called.
int ttse_send_result | ( | ttse_result_event_e | event, |
const void * | data, | ||
unsigned int | data_size, | ||
ttse_audio_type_e | audio_type, | ||
int | rate, | ||
void * | user_data | ||
) |
Sends the synthesized result to the engine service user.
- Since :
- 3.0
- Remarks:
- This API is used in ttse_start_synthesis_cb(), when TTS engine sends the synthesized result to the engine service user. The synthesized result and user_data must be transferred to the engine service user through this function.
- Parameters:
-
[in] event The result event [in] data Result data [in] data_size Result data size [in] audio_type The audio type [in] rate The sample rate [in] user_data The user data passed from ttse_start_synthesis_cb()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
- Precondition:
- The ttse_main() function should be invoked before this function is called. ttse_start_synthesis_cb() will invoke this function.
- See also:
- ttse_start_synthesis_cb()
int ttse_set_private_data_requested_cb | ( | ttse_private_data_requested_cb | callback_func | ) |
Sets a callback function for requesting the private data.
- Since :
- 3.0
- Remarks:
- The ttse_private_data_requested_cb() function is called when the engine service user gets the private data from TTS engine.
- Parameters:
-
[in] callback_func ttse_private_data_requested event callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
- Precondition:
- The ttse_main() function should be invoked before this function is called.
- See also:
- ttse_private_data_requested_cb()
int ttse_set_private_data_set_cb | ( | ttse_private_data_set_cb | callback_func | ) |
Sets a callback function for setting the private data.
- Since :
- 3.0
- Remarks:
- The ttse_private_data_set_cb() function is called when the engine service user sends the private data.
- Parameters:
-
[in] callback_func ttse_private_data_set event callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
TTSE_ERROR_NONE Successful TTSE_ERROR_INVALID_PARAMETER Invalid parameter TTSE_ERROR_NOT_SUPPORTED Not supported TTSE_ERROR_OPERATION_FAILED Operation failure
- Precondition:
- The ttse_main() function should be invoked before this function is called.
- See also:
- ttse_private_data_set_cb()