Tizen Native API  5.5
TTS Engine

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.

Related Features

This API is related with the following features:

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_NONESuccessful
TTSE_ERROR_INVALID_STATENot 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]appidThe Application ID
[out]is_agreedA 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_NONESuccessful
TTSE_ERROR_INVALID_STATENot initialized
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTED_FEATURENot 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_NONESuccessful
TTSE_ERROR_INVALID_STATENot 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]callbackThe callback function
[in]user_dataThe user data which must be passed to ttse_supported_voice_cb()
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATENot 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_uuidUUID of engine
[out]engine_nameName of engine
[out]engine_settingThe engine setting application(ui app)'s app ID
[out]use_networkThe status for using network
Returns:
0 on success, otherwise a negative error code on failure
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_OPERATION_FAILEDOperation 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_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATEAlready initialized
TTSE_ERROR_OPERATION_FAILEDOperation failure
TTSE_ERROR_PERMISSION_DENIEDPermission 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]languageThe 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]typeThe voice type
[out]is_validA 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_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid 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]languageThe 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]typeThe voice type
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATENot initialized
TTSE_ERROR_OUT_OF_MEMORYOut of memory
TTSE_ERROR_INVALID_VOICEInvalid voice
TTSE_ERROR_OPERATION_FAILEDOperation 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, otherwise false
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]keyThe key field of private data
[out]dataThe data field of private data
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_OPERATION_FAILEDOperation failure
TTSE_ERROR_NOT_SUPPORTED_FEATURENot supported feature
See also:
ttse_private_data_set_cb()
ttse_set_private_data_requested_cb()
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]keyThe key field of private data
[in]dataThe data field of private data
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_OPERATION_FAILEDOperation failure
TTSE_ERROR_NOT_SUPPORTED_FEATURENot supported feature
See also:
ttse_private_data_requested_cb()
ttse_set_private_data_set_cb()
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]pitchThe default pitch
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATENot initialized
TTSE_ERROR_OPERATION_FAILEDOperation 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]languageThe 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]typeThe voice type
[in]textTexts
[in]speedThe speed of speaking
[in]appidThe Application ID
[in]credentialThe credential granted to the application
[in]user_dataThe user data which must be passed to ttse_send_result()
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATENot initialized or already started synthesis
TTSE_ERROR_INVALID_VOICEInvalid voice
TTSE_ERROR_OPERATION_FAILEDOperation failure
TTSE_ERROR_NETWORK_DOWNOut of network
TTSE_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
This function invokes ttse_send_result().
See also:
ttse_send_result()
ttse_cancel_synthesis_cb()
ttse_need_app_credential_cb()
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]languageThe 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]typeThe voice type
[in]user_dataThe user data passed from ttse_foreach_supported_voices_cb()
Returns:
true to continue with the next iteration of the loop false 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]languageThe 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]typeThe voice type
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_INVALID_STATENot initialized
TTSE_ERROR_INVALID_VOICEInvalid voice
TTSE_ERROR_OPERATION_FAILEDOperation failure
See also:
ttse_load_voice_cb()

Enumeration Type Documentation

Enumeration for audio type.

Since :
3.0
Enumerator:
TTSE_AUDIO_TYPE_RAW_S16 

Signed 16-bit audio type

TTSE_AUDIO_TYPE_RAW_U8 

Unsigned 8-bit audio type

Enumeration for error codes.

Since :
3.0
Enumerator:
TTSE_ERROR_NONE 

Successful

TTSE_ERROR_OUT_OF_MEMORY 

Out of Memory

TTSE_ERROR_IO_ERROR 

I/O error

TTSE_ERROR_INVALID_PARAMETER 

Invalid parameter

TTSE_ERROR_NETWORK_DOWN 

Out of network

TTSE_ERROR_PERMISSION_DENIED 

Permission denied

TTSE_ERROR_INVALID_STATE 

Invalid state

TTSE_ERROR_INVALID_VOICE 

Invalid voice

TTSE_ERROR_OPERATION_FAILED 

Operation failed

TTSE_ERROR_NOT_SUPPORTED_FEATURE 

Not supported feature

TTSE_ERROR_NOT_SUPPORTED 

Not supported

Enumeration for result event type.

Since :
3.0
Enumerator:
TTSE_RESULT_EVENT_FAIL 

Event when the voice synthesis is failed

TTSE_RESULT_EVENT_START 

Event when the sound data is first data by callback function

TTSE_RESULT_EVENT_CONTINUE 

Event when the next sound data exist, not first and not last

TTSE_RESULT_EVENT_FINISH 

Event when the sound data is last data or sound data is only one result


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]minThe minimum pitch value
[out]normalThe normal pitch value
[out]maxThe maximum pitch value
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation 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]minThe minimum speed value
[out]normalThe normal speed value
[out]maxThe maximum speed value
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation 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]argcThe argument count(original)
[in]argvThe argument(original)
[in]callbackThe structure of engine request callback function
Returns:
This function returns zero on success, or negative with error code on failure
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_OPERATION_FAILEDOperation failure
TTSE_ERROR_NOT_SUPPORTEDNot 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]errorThe error reason
[in]msgThe error message
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation 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]eventThe result event
[in]dataResult data
[in]data_sizeResult data size
[in]audio_typeThe audio type
[in]rateThe sample rate
[in]user_dataThe user data passed from ttse_start_synthesis_cb()
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation 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()

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_functtse_private_data_requested event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation failure
Precondition:
The ttse_main() function should be invoked before this function is called.
See also:
ttse_private_data_requested_cb()

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_functtse_private_data_set event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
TTSE_ERROR_NONESuccessful
TTSE_ERROR_INVALID_PARAMETERInvalid parameter
TTSE_ERROR_NOT_SUPPORTEDNot supported
TTSE_ERROR_OPERATION_FAILEDOperation failure
Precondition:
The ttse_main() function should be invoked before this function is called.
See also:
ttse_private_data_set_cb()