Add checking personal voice and create speak data with personal voice id 21/317621/1
authordyamy-lee <dyamy.lee@samsung.com>
Fri, 26 Jul 2024 02:22:36 +0000 (11:22 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Thu, 12 Sep 2024 08:44:54 +0000 (17:44 +0900)
For executing add_text_with_synthesis_parameter, it needs some checking points.
First, it adds some logic for checking personal voice information as voice_list in ttsd_engine_select_valid_voice.
Then, it needs to create speak data with personal voice information.
For that, ttsd_engine_start_synthesis API also needs ptts_id as parameter.

Change-Id: I5348fd761693759c7867493b675c5ea35842bc8c

common/tts_config_mgr.c
include/ttse.h
server/ttsd_config.c
server/ttsd_config.h
server/ttsd_data.cpp
server/ttsd_data.h
server/ttsd_engine_agent.c
server/ttsd_engine_agent.h
server/ttsd_server.c

index 79baebd..65ebd96 100644 (file)
@@ -2461,12 +2461,8 @@ int tts_config_mgr_update_personal_voice(const char* engine_id, const char* lang
        }
 
        SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Finish update personal info");
-       tts_personal_info_s* info = NULL;
-       int ret = tts_parser_get_personal_info(filepath, &info);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get personal info");
-               return -1;
-       }
+
+       __tts_config_mgr_print_personal_info(engine_id);
 
        return 0;
 }
index ca92981..6577f3e 100755 (executable)
@@ -103,6 +103,8 @@ typedef enum {
 */
 #define TTSE_VOICE_TYPE_CHILD  3
 
+#define TTSE_VOICE_TYPE_PERSONAL       4
+
 /**
 * @brief Called when TTS engine informs the engine service user about whole supported language and voice type list.
 * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
index 3530106..67352bb 100644 (file)
@@ -24,6 +24,8 @@ static ttsd_config_changed_cb g_callback;
 
 static ttsd_config_screen_reader_changed_cb g_sr_callback;
 
+static ttsd_config_supported_personal_voice_cb g_personal_voice_cb;
+
 void __ttsd_config_engine_changed_cb(const char* engine_id, const char* setting, const char* language, int voice_type, bool auto_voice, bool need_credential, void* user_data)
 {
        /* Need to check engine is valid */
@@ -277,3 +279,39 @@ int ttsd_config_update_personal_voice(const char* language, const char* unique_i
 
        return 0;
 }
+
+bool __ttsd_config_personal_voices(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data)
+{
+       if (NULL == g_personal_voice_cb) {
+               SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Fail to get g_personal_voice_callback");
+               return false;
+       }
+
+       g_personal_voice_cb(language, unique_id, user_data);
+       return true;
+}
+
+int ttsd_config_get_personal_voices_list(ttsd_config_supported_personal_voice_cb personal_voice_cb, void* user_data)
+{
+       if (NULL == personal_voice_cb) {
+               SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] No personal voice callback parameter");
+               return -1;
+       }
+
+       g_personal_voice_cb = personal_voice_cb;
+
+       char* current_engine = NULL;
+       int ret = tts_config_mgr_get_engine(&current_engine);
+       if (0 != ret || NULL == current_engine) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get current engine : %d", ret);
+               return ret;
+       }
+
+       ret = tts_config_mgr_get_personal_voice_list(current_engine, __ttsd_config_personal_voices, user_data);
+       if (TTS_CONFIG_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config ERROR] Fail to get persoanl voice list. ret(%d)", ret);
+               return TTSD_ERROR_OPERATION_FAILED;
+       }
+
+       return TTSD_ERROR_NONE;
+}
index 70097e0..e1f1a7c 100644 (file)
@@ -33,6 +33,8 @@ typedef void (*ttsd_config_changed_cb)(tts_config_type_e type, const char* str_p
 
 typedef void (*ttsd_config_screen_reader_changed_cb)(bool value);
 
+typedef bool (*ttsd_config_supported_personal_voice_cb)(const char* language, const char* unique_id, void* user_data);
+
 int ttsd_config_initialize(ttsd_config_changed_cb config_cb);
 
 int ttsd_config_finalize();
@@ -60,6 +62,8 @@ int ttsd_config_set_instant_reprepare_client(const unsigned int uid);
 
 int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data);
 
+int ttsd_config_get_personal_voices_list(ttsd_config_supported_personal_voice_cb personal_voice_cb, void* user_data);
+
 #ifdef __cplusplus
 }
 #endif
index 2a8dfb6..8c25dc2 100644 (file)
@@ -196,8 +196,8 @@ int ttsd_data_new_client(int pid, unsigned int uid, ttsd_mode_e mode, ttsd_playi
 
 static inline void destroy_speak_data(speak_data_s* speak_data)
 {
-       SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] utt(%d), text(%s), lang(%s), vctype(%d) speed(%d)",
-               speak_data->utt_id, speak_data->text == nullptr ? "NULL" : speak_data->text, speak_data->voice.language == nullptr ? "NULL" : speak_data->voice.language, speak_data->voice.type, speak_data->synth_parameter.speed);
+       SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] utt(%d), text(%s), lang(%s), vctype(%d) speed(%d) ptts_id(%s)",
+               speak_data->utt_id, speak_data->text == nullptr ? "NULL" : speak_data->text, speak_data->voice.language == nullptr ? "NULL" : speak_data->voice.language, speak_data->voice.type, speak_data->synth_parameter.speed, speak_data->voice.ptts_id == nullptr ? "NULL" : speak_data->voice.ptts_id);
 
        free(speak_data->text);
        speak_data->text = nullptr;
@@ -483,7 +483,7 @@ int ttsd_data_reset_used_voice(unsigned int uid, ttsd_used_voice_cb callback)
        return TTSD_ERROR_NONE;
 }
 
-speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, int utt_id, bool is_silent, unsigned int duration_in_msec)
+speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language, int voice_type, const char* ptts_id, int speed, int pitch, double volume, double background_volume_ratio, int utt_id, bool is_silent, unsigned int duration_in_msec)
 {
        speak_data_s* speak_data = new speak_data_s();
        if (nullptr == speak_data) {
@@ -505,7 +505,13 @@ speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language
                speak_data->voice.language = strdup(language);
        }
 
-       speak_data->voice.ptts_id = nullptr;
+       if (ptts_id == NULL) {
+               speak_data->voice.ptts_id = nullptr;
+               SLOG(LOG_INFO, tts_tag(), "[DATA INFO] ptts_id of speak_data for silent generation is null");
+       } else {
+               speak_data->voice.ptts_id = strdup(ptts_id);
+       }
+
        speak_data->voice.type = voice_type;
 
        speak_data->synth_parameter.speed = speed;
@@ -549,8 +555,8 @@ int ttsd_data_add_speak_data(unsigned int uid, speak_data_s* data)
                return TTSD_ERROR_OUT_OF_MEMORY;
        }
 
-       SLOG(LOG_ERROR, tts_tag(), "[DATA][%p] utt_id(%d), text(%s), lang(%s), vctype(%d), speed(%d)",
-                data, data->utt_id, data->text, data->voice.language, data->voice.type, data->synth_parameter.speed);
+       SLOG(LOG_ERROR, tts_tag(), "[DATA][%p] utt_id(%d), text(%s), lang(%s), vctype(%d), speed(%d), ptts_id(%s)",
+                data, data->utt_id, data->text, data->voice.language, data->voice.type, data->synth_parameter.speed, data->voice.ptts_id == nullptr ? "NULL" : data->voice.ptts_id);
 
        if (1 == data->utt_id)
                app_data->utt_id_stopped = 0;
@@ -1007,9 +1013,9 @@ int ttsd_data_save_error_log(unsigned int uid, FILE* fp)
 
        i = 0;
        for (auto& speakData : app_data->m_speak_data) {
-               SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s)",
+               SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s), ptts_id(%s)",
                         i, speakData, speakData->voice.language, speakData->voice.type, speakData->synth_parameter.speed,
-                        speakData->utt_id, speakData->text);
+                        speakData->utt_id, speakData->text, speakData->voice.ptts_id == nullptr ? "NULL" : speakData->voice.ptts_id);
                i++;
        }
        fprintf(fp, "---------------------");
index 73fc7eb..4205183 100644 (file)
@@ -99,7 +99,7 @@ int ttsd_data_set_credential(unsigned int uid, const char* credential);
 char* ttsd_data_get_credential(unsigned int uid);
 
 /* speak data */
-speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language, int voice_type, int speed, int pitch, double volume, double bg_volume, int utt_id, bool is_silent, unsigned int duration_in_msec);
+speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language, int voice_type, const char* ptts_id, int speed, int pitch, double volume, double bg_volume, int utt_id, bool is_silent, unsigned int duration_in_msec);
 
 void ttsd_data_destroy_speak_data(speak_data_s* speak_data);
 
index ba65fc1..eda50d0 100644 (file)
@@ -67,6 +67,7 @@ static GSList* g_cur_voices = NULL;
 
 /** Callback function for voice list */
 static bool __supported_voice_cb(const char* language, int type, void* user_data);
+static bool __supported_personal_voice_cb(const char* language, const char* unique_id, void* user_data);
 
 /** Free voice list */
 static void __free_voice_list(GList* voice_list);
@@ -537,7 +538,7 @@ bool ttsd_engine_agent_is_same_engine(const char* engine_id)
        return false;
 }
 
-bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang, int* out_type)
+bool ttsd_engine_select_valid_voice(const char* lang, int type, const char* ptts_id, char** out_lang, int* out_type, char** out_ptts_id)
 {
        if (NULL == lang || NULL == out_lang || NULL == out_type) {
                return false;
@@ -549,8 +550,8 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                return false;
        }
 
-       SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Select voice : input lang(%s), input type(%d), default lang(%s), default type(%d)",
-               (NULL == lang) ? "NULL" : lang, type, (NULL == g_engine_info->default_lang) ? "NULL" : g_engine_info->default_lang, g_engine_info->default_vctype);
+       SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Select voice : input lang(%s), input type(%d), input ptts_id(%s), default lang(%s), default type(%d)",
+               (NULL == lang) ? "NULL" : lang, type, (NULL == ptts_id) ? "NULL" : ptts_id, (NULL == g_engine_info->default_lang) ? "NULL" : g_engine_info->default_lang, g_engine_info->default_vctype);
 
        /* case 1 : Both are default */
        if (0 == strncmp(lang, "default", strlen(lang)) && 0 == type) {
@@ -561,6 +562,7 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                }
 
                *out_type = g_engine_info->default_vctype;
+               *out_ptts_id = NULL;
                return true;
        }
 
@@ -572,6 +574,15 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                return false;
        }
 
+       if (type == TTSE_VOICE_TYPE_PERSONAL) {
+               SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] voice type is personal");
+               ret = ttsd_config_get_personal_voices_list(__supported_personal_voice_cb, &voice_list);
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] No supported personal voice");
+                       return false;
+               }
+       }
+
        bool result;
        result = false;
 
@@ -587,6 +598,15 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                        voice = iter->data;
 
                        if (0 == strncmp(voice->language, lang, strlen(lang)) &&  voice->type == type) {
+                               if (type == TTSE_VOICE_TYPE_PERSONAL && NULL!= ptts_id) {
+                                       if (0 != strncmp(voice->ptts_id, ptts_id, strlen(voice->ptts_id))) {
+                                               iter = g_list_next(iter);
+                                               continue;
+                                       }
+                                       *out_ptts_id = strdup(voice->ptts_id);
+                               } else {
+                                       *out_ptts_id = NULL;
+                               }
                                *out_lang = strdup(voice->language);
                                *out_type = voice->type;
                                result = true;
@@ -596,11 +616,12 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                        iter = g_list_next(iter);
                }
 
-       } else if (0 != strncmp(lang, "default", strlen("default")) && 0 == type) {
+       } else if (0 != strncmp(lang, "default", strlen("default")) && 0 == type) {  // default type != personal_type
                /* Only type is default */
                if (0 == strncmp(lang, g_engine_info->default_lang, strlen(g_engine_info->default_lang))) {
                        *out_lang = strdup(g_engine_info->default_lang);
                        *out_type = g_engine_info->default_vctype;
+                       *out_ptts_id = NULL;
                        result = true;
                } else {
                        voice_s* voice_selected = NULL;
@@ -622,14 +643,16 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                        if (NULL != voice_selected) {
                                *out_lang = strdup(voice_selected->language);
                                *out_type = voice_selected->type;
+                               *out_ptts_id = NULL;
                                result = true;
                        }
                }
        } else if (0 == strncmp(lang, "default", strlen("default")) && 0 != type) {
                /* Only lang is default */
-               if (type == g_engine_info->default_vctype) {
+               if (type == g_engine_info->default_vctype) { // default type != personal_type
                        *out_lang = strdup(g_engine_info->default_lang);
                        *out_type = g_engine_info->default_vctype;
+                       *out_ptts_id = NULL;
                        result = true;
                } else {
                        voice_s* voice_selected = NULL;
@@ -641,6 +664,12 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                                if (0 == strncmp(voice->language, g_engine_info->default_lang, strlen(g_engine_info->default_lang))) {
                                        voice_selected = voice;
                                        if (voice->type == type) {
+                                               if (type == TTSE_VOICE_TYPE_PERSONAL && NULL != ptts_id) {
+                                                       if (0 != strncmp(voice->ptts_id, ptts_id, strlen(voice->ptts_id))) {
+                                                               iter = g_list_next(iter);
+                                                               continue;
+                                                       }
+                                               }
                                                voice_selected = voice;
                                                break;
                                        }
@@ -651,13 +680,21 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                        if (NULL != voice_selected) {
                                *out_lang = strdup(voice->language);
                                *out_type = voice_selected->type;
+                               if (type == TTSE_VOICE_TYPE_PERSONAL && NULL != voice->ptts_id) {
+                                       *out_ptts_id = strdup(voice->ptts_id);
+                               } else {
+                                       *out_ptts_id = NULL;
+                               }
                                result = true;
                        }
                }
        }
 
        if (true == result) {
-               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Selected voice : lang(%s), type(%d)", *out_lang, *out_type);
+               if (NULL != ptts_id)
+                       SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Selected voice : lang(%s), type(%d), ptts_id(%s)", *out_lang, *out_type, *out_ptts_id);
+               else
+                       SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Selected voice : lang(%s), type(%d)", *out_lang, *out_type);
        }
 
        __free_voice_list(voice_list);
@@ -974,7 +1011,7 @@ int ttsd_engine_unload_voice(const char* lang, const int vctype)
        return TTSD_ERROR_NONE;
 }
 
-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_start_synthesis(const char* lang, int vctype, const char* ptts_id, 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");
@@ -990,7 +1027,8 @@ int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text,
        /* select voice for default */
        char* temp_lang = NULL;
        int temp_type;
-       if (true != ttsd_engine_select_valid_voice(lang, vctype, &temp_lang, &temp_type)) {
+       char* temp_ptts_id = NULL;
+       if (true != ttsd_engine_select_valid_voice(lang, vctype, ptts_id, &temp_lang, &temp_type, &temp_ptts_id)) {
                SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to select default voice");
                if (NULL != temp_lang) {
                        free(temp_lang);
@@ -998,8 +1036,8 @@ int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text,
                }
                return TTSD_ERROR_INVALID_VOICE;
        } else {
-               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);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Start synthesis : language(%s), type(%d), ptts_id(%s), speed(%d), text(%s), credential(%s)",
+                       (NULL == temp_lang) ? "NULL" : temp_lang, temp_type, (NULL == temp_ptts_id) ? "NULL" : temp_ptts_id, speed, (NULL == text) ? "NULL" : text, (NULL == credential) ? "NULL" : credential);
        }
 
        int temp_speed;
@@ -1064,6 +1102,31 @@ bool __supported_voice_cb(const char* language, int type, void* user_data)
        }
        voice->language = strdup(language);
        voice->type = type;
+       voice->ptts_id = NULL;
+
+       *voice_list = g_list_append(*voice_list, voice);
+
+       return true;
+}
+
+bool __supported_personal_voice_cb(const char* language, const char* unique_id, void* user_data)
+{
+       GList** voice_list = (GList**)user_data;
+
+       if (NULL == voice_list) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Input parameter is NULL in voice list callback!!!!");
+               return false;
+       }
+
+       voice_s* voice = calloc(1, sizeof(voice_s));
+       if (NULL == voice) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to allocate memory");
+               return false;
+       }
+
+       voice->language = strdup(language);
+       voice->type = TTSE_VOICE_TYPE_PERSONAL;
+       voice->ptts_id = strdup(unique_id);
 
        *voice_list = g_list_append(*voice_list, voice);
 
@@ -1239,6 +1302,10 @@ void __free_voice_list(GList* voice_list)
                                        free(data->language);
                                        data->language = NULL;
                                }
+                               if (NULL != data->ptts_id) {
+                                       free(data->ptts_id);
+                                       data->ptts_id = NULL;
+                               }
                                free(data);
                                data = NULL;
                        }
index a84ccbf..fe2bb37 100644 (file)
@@ -48,7 +48,7 @@ int ttsd_engine_agent_unload_current_engine();
 /** Get state of current engine to need network */
 bool ttsd_engine_agent_need_network();
 
-bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang, int* out_type);
+bool ttsd_engine_select_valid_voice(const char* lang, int type, const char* ptts_id, char** out_lang, int* out_type, char** out_ptts_id);
 
 bool ttsd_engine_agent_is_same_engine(const char* engine_id);
 
@@ -81,7 +81,7 @@ int ttsd_engine_load_voice(const char* lang, int vctype);
 
 int ttsd_engine_unload_voice(const char* lang, int vctype);
 
-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_start_synthesis(const char* lang, int vctype, const char* ptts_id, const char* text, int speed, const char* appid, const char* credential, void* user_param);
 
 int ttsd_engine_cancel_synthesis();
 
index 757b049..62a15a5 100644 (file)
@@ -123,8 +123,9 @@ static void write_debugger_information(speak_data_s *speak_data, const char *app
 
        char* temp_lang = NULL;
        int temp_type;
-       if (true != ttsd_engine_select_valid_voice(speak_data->voice.language, speak_data->voice.type, &temp_lang,
-                                                                                          &temp_type)) {
+       char* temp_ptts_id = NULL;
+       if (true != ttsd_engine_select_valid_voice(speak_data->voice.language, speak_data->voice.type, NULL, &temp_lang,
+                                                                                          &temp_type, &temp_ptts_id)) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select default voice");
        } else {
                char value_buffer[2048] = {0, };
@@ -195,8 +196,8 @@ static void __synthesis(unsigned int uid)
 
                SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------");
                SLOG(LOG_INFO, tts_tag(), "ID : uid (%u), uttid(%d) ", g_utt.uid, g_utt.uttid);
-               SLOG(LOG_INFO, tts_tag(), "Voice : language(%s), type(%d), speed(%d)", speak_data->voice.language,
-                       speak_data->voice.type, speak_data->synth_parameter.speed);
+               SLOG(LOG_INFO, tts_tag(), "Voice : language(%s), type(%d), ptts_id(%s), speed(%d)", speak_data->voice.language,
+                       speak_data->voice.type, speak_data->voice.ptts_id, speak_data->synth_parameter.speed);
                SLOG(LOG_INFO, tts_tag(), "Text : %s", speak_data->text);
                SLOG(LOG_INFO, tts_tag(), "Credential : %s", credential);
                SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------");
@@ -213,7 +214,7 @@ static void __synthesis(unsigned int uid)
                        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,
+               ret = ttsd_engine_start_synthesis(speak_data->voice.language, speak_data->voice.type, speak_data->voice.ptts_id, 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 !!!! * ");
@@ -528,9 +529,10 @@ static void __config_changed_cb(tts_config_type_e type, const char* str_param, i
 
                char* out_lang = NULL;
                int out_type;
+               char* temp_ptts_id = NULL;
                int ret = -1;
 
-               if (true == ttsd_engine_select_valid_voice(str_param, int_param, &out_lang, &out_type)) {
+               if (true == ttsd_engine_select_valid_voice(str_param, int_param, NULL, &out_lang, &out_type, &temp_ptts_id)) {
                        SLOG(LOG_ERROR, tts_tag(), "[Server] valid language : lang(%s), type(%d)", out_lang, out_type);
                        ret = ttsd_engine_agent_set_default_voice(out_lang, out_type);
                        if (0 != ret)
@@ -1094,7 +1096,8 @@ int ttsd_server_add_text(unsigned int uid, const char* text, const char* lang, i
        /* check valid voice */
        char* temp_lang = NULL;
        int temp_type;
-       if (true != ttsd_engine_select_valid_voice((const char*)lang, voice_type, &temp_lang, &temp_type)) {
+       char* temp_ptts_id = NULL;
+       if (true != ttsd_engine_select_valid_voice((const char*)lang, voice_type, NULL, &temp_lang, &temp_type, &temp_ptts_id)) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select valid voice");
                if (NULL != temp_lang) {
                        free(temp_lang);
@@ -1108,7 +1111,7 @@ int ttsd_server_add_text(unsigned int uid, const char* text, const char* lang, i
                return TTSD_ERROR_INVALID_VOICE;
        }
 
-       speak_data_s* speak_data = ttsd_data_create_speak_data(text, lang, voice_type, speed, 0, -1.0, -1.0, utt_id, false, 0);
+       speak_data_s* speak_data = ttsd_data_create_speak_data(text, lang, voice_type, NULL, speed, 0, -1.0, -1.0, utt_id, false, 0);
        if (NULL == speak_data) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
                if (NULL != temp_lang) {
@@ -1184,8 +1187,9 @@ int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char*
 
        /* check valid voice */
        char* temp_lang = NULL;
+       char* temp_ptts_id = NULL;
        int temp_type;
-       if (true != ttsd_engine_select_valid_voice((const char*)lang, voice_type, &temp_lang, &temp_type)) {
+       if (true != ttsd_engine_select_valid_voice((const char*)lang, voice_type, ptts_id, &temp_lang, &temp_type, &temp_ptts_id)) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select valid voice");
                if (NULL != temp_lang) {
                        free(temp_lang);
@@ -1199,7 +1203,7 @@ int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char*
                return TTSD_ERROR_INVALID_VOICE;
        }
 
-       speak_data_s* speak_data = ttsd_data_create_speak_data(text, lang, voice_type, speed, pitch, volume, background_volume_ratio, utt_id, false, 0);
+       speak_data_s* speak_data = ttsd_data_create_speak_data(text, lang, voice_type, ptts_id, speed, pitch, volume, background_volume_ratio, utt_id, false, 0);
        if (NULL == speak_data) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
                if (NULL != temp_lang) {
@@ -1273,7 +1277,7 @@ int ttsd_server_add_silent_utterance(unsigned int uid, unsigned int duration_in_
                return TTSD_ERROR_INVALID_PARAMETER;
        }
 
-       speak_data_s* speak_data = ttsd_data_create_speak_data(NULL, NULL, 0, 0, 0, -1.0, -1.0, utt_id, true, duration_in_msec);
+       speak_data_s* speak_data = ttsd_data_create_speak_data(NULL, NULL, 0, NULL, 0, 0, -1.0, -1.0, utt_id, true, duration_in_msec);
        if (NULL == speak_data) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
                return TTSD_ERROR_OPERATION_FAILED;