/**
+* @brief Called when the engine service user sets the personal tts id of TTS engine.
+* @since_tizen 9.0
+* @remarks This callback function is mandatory and must be registered using ttse_main().
+* @param[in] ptts_id The personal tts id
+* @return @c 0 on success,
+* otherwise a negative error value
+* @retval #TTSE_ERROR_NONE Successful
+* @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
+* @retval #TTSE_ERROR_INVALID_STATE Not initialized
+* @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
+*/
+typedef int (*ttse_set_personal_tts_id)(const char* ptts_id);
+
+
+/**
* @brief Called when the engine service user requests to load the corresponding voice type for the first time.
* @since_tizen 3.0
* @remarks This callback function is mandatory and must be registered using ttse_main().
* For example, "ko_KR" for Korean, "en_US" for American English
* @param[in] type The voice type
* @param[in] text Texts
-* @param[in] ptts_id The id of personal TTS
* @param[in] speed The speed of speaking
-* @param[in] pitch The pitch of speaking
* @param[in] appid The Application ID
* @param[in] credential The credential granted to the application
* @param[in] user_data The user data which must be passed to ttse_send_result()
* @see ttse_cancel_synthesis_cb()
* @see ttse_need_app_credential_cb()
*/
-typedef int (*ttse_start_synthesis_cb)(const char* language, int type, const char* text, const char* ptts_id, int speed, int pitch, const char* appid, const char* credential, void* user_data);
+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);
/**
ttse_foreach_supported_voices_cb foreach_voices; /**< Called when the engine service user gets the whole supported voice list */
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 */
ttse_set_pitch_cb set_pitch; /**< Called when the engine service user sets the default pitch of TTS engine */
+ ttse_set_personal_tts_id set_personal_tts_id; /**< Called when the engine service user sets the personal tts of TTS engine */
ttse_load_voice_cb load_voice; /**< Called when the engine service user requests to load the corresponding voice type for the first time */
ttse_unload_voice_cb unload_voice; /**< Called when the engine service user requests to unload the corresponding voice type or to stop using voice */
int default_vctype;
int default_speed;
int default_pitch;
+ char* ptts_id;
} ttsengine_info_s;
typedef struct {
g_engine_info->default_lang = NULL;
}
+ if (NULL != g_engine_info->ptts_id) {
+ free(g_engine_info->ptts_id);
+ g_engine_info->ptts_id = NULL;
+ }
+
if (NULL != g_engine_info->engine_uuid) {
free(g_engine_info->engine_uuid);
g_engine_info->engine_uuid = NULL;
return TTSD_ERROR_NONE;
}
+int ttsd_engine_agent_set_personal_tts_id(const char* ptts_id)
+{
+ if (NULL == ptts_id) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] ptts_id is NULL");
+ return TTSD_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = __check_engine_initialized_and_loaded();
+ if (TTSD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Precondition is not met(%s)", get_error_message(ret));
+ return ret;
+ }
+
+ ret = g_engine_info->callbacks->set_personal_tts_id(ptts_id);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to set personal tts id : ptts_id(%s), result(%s)",
+ ptts_id, __ttsd_get_engine_error_code(ret));
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ if (NULL != g_engine_info->ptts_id) {
+ free(g_engine_info->ptts_id);
+ g_engine_info->ptts_id = NULL;
+ }
+ g_engine_info->ptts_id = strdup(ptts_id);
+
+ SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Set personal tts id(%s)", ptts_id);
+ return TTSD_ERROR_NONE;
+}
+
int ttsd_engine_agent_is_credential_needed(unsigned int uid, bool* credential_needed)
{
if (NULL == credential_needed) {
return TTSD_ERROR_NONE;
}
-int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text, const char* ptts_id, int speed, int pitch, const char* appid, const char* credential, void* user_param)
+int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text, int speed, const char* appid, const char* credential, void* user_param)
{
if (NULL == lang || NULL == text) {
SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Invalid parameter");
}
return TTSD_ERROR_INVALID_VOICE;
} else {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Start synthesis : language(%s), type(%d), ptts_id(%s), speed(%d), pitch(%d), text(%s), credential(%s)",
- (NULL == temp_lang) ? "NULL" : temp_lang, temp_type, (NULL == ptts_id) ? "NULL" : ptts_id, speed, pitch, (NULL == text) ? "NULL" : text, (NULL == credential) ? "NULL" : credential);
+ SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Start synthesis : language(%s), type(%d), speed(%d), text(%s), credential(%s)",
+ (NULL == temp_lang) ? "NULL" : temp_lang, temp_type, speed, (NULL == text) ? "NULL" : text, (NULL == credential) ? "NULL" : credential);
}
int temp_speed;
temp_speed = speed;
}
- int temp_pitch;
-
- if (0 == pitch) {
- temp_pitch = g_engine_info->default_pitch;
- } else {
- temp_pitch = pitch;
- }
-
/* synthesize text */
- ret = g_engine_info->callbacks->start_synth(temp_lang, temp_type, text, ptts_id, temp_speed, temp_pitch, appid, credential, user_param);
+ ret = g_engine_info->callbacks->start_synth(temp_lang, temp_type, text, temp_speed, appid, credential, user_param);
if (0 != ret) {
SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] ***************************************");
SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] * synthesize error : %s *", __ttsd_get_engine_error_code(ret));
int ttsd_engine_agent_set_default_pitch(int pitch);
+int ttsd_engine_agent_set_personal_tts_id(const char* ptts_id);
+
int ttsd_engine_agent_is_credential_needed(unsigned int uid, bool* credential_needed);
int ttsd_engine_set_private_data(const char* key, const char* data);
int ttsd_engine_unload_voice(const char* lang, int vctype);
-int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text, const char* ptts_id, int speed, int pitch, const char* appid, const char* credential, void* user_param);
+int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text, int speed, const char* appid, const char* credential, void* user_param);
int ttsd_engine_cancel_synthesis();
ttse_foreach_supported_voices_cb foreach_voices;
ttse_is_valid_voice_cb is_valid_voice;
ttse_set_pitch_cb set_pitch;
+ ttse_set_personal_tts_id set_personal_tts_id;
ttse_load_voice_cb load_voice;
ttse_unload_voice_cb unload_voice;
SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------");
ttsd_data_set_synth_control(TTSD_SYNTHESIS_CONTROL_DOING);
- ret = ttsd_engine_start_synthesis(speak_data->voice.language, speak_data->voice.type, speak_data->text, speak_data->voice.ptts_id,
- speak_data->synth_parameter.speed, speak_data->synth_parameter.pitch, appid, credential, NULL);
+
+ ret = ttsd_engine_agent_set_default_pitch(speak_data->synth_parameter.pitch);
+ if (TTSD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] * FAIL to set pitch !!!! * ");
+ }
+
+ ret = ttsd_engine_agent_set_personal_tts_id(speak_data->voice.ptts_id);
+ if (TTSD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] * FAIL to set personal tts id !!!! * ");
+ }
+
+ ret = ttsd_engine_start_synthesis(speak_data->voice.language, speak_data->voice.type, speak_data->text,
+ speak_data->synth_parameter.speed, appid, credential, NULL);
if (TTSD_ERROR_NONE != ret) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] * FAIL to start SYNTHESIS !!!! * ");