Add internal apis for setting engine_type of synthesized speech 51/318151/3
authorsooyeon <sooyeon.kim@samsung.com>
Wed, 25 Sep 2024 06:28:17 +0000 (15:28 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Mon, 7 Oct 2024 12:14:26 +0000 (21:14 +0900)
Change-Id: Id144433609ea541de2509ef8242de2ef2f9f6104
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
15 files changed:
client/tts.c
client/tts_main.h
client/tts_tidl.c
include/tts_internal.h
include/ttse_internal.h [new file with mode: 0755]
server/ttsd_data.cpp
server/ttsd_data.h
server/ttsd_engine_agent.c
server/ttsd_engine_agent.h
server/ttsd_main.h
server/ttsd_server.c
server/ttsd_server.h
server/ttsd_tidl.c
server/ttse.c
tidl/tts.tidl

index 1edde0b53a58c6c7c010fe48f0f21cfdc70d5ba6..0583294714a91ceaddaf53626dd5b19e6076a80a 100644 (file)
@@ -1522,6 +1522,11 @@ int tts_synthesis_parameter_destroy(tts_synthesis_parameter_h parameter)
                parameter->ptts_id = NULL;
        }
 
+       if (parameter->engine_type) {
+               free(parameter->engine_type);
+               parameter->engine_type = NULL;
+       }
+
        free(parameter);
        parameter = NULL;
 
@@ -1633,6 +1638,23 @@ int tts_synthesis_parameter_set_background_volume_ratio(tts_synthesis_parameter_
        return TTS_ERROR_NONE;
 }
 
+int tts_synthesis_parameter_set_engine_type(tts_synthesis_parameter_h parameter, const char *engine_type)
+{
+       SLOG(LOG_INFO, TAG_TTSC, "@@@ Set engine_type to a synthesis parameter");
+       RETV_IF(TTS_ERROR_NONE != __tts_get_feature_enabled(), TTS_ERROR_NOT_SUPPORTED);
+
+       RETVM_IF(NULL == parameter || NULL == engine_type, TTS_ERROR_INVALID_PARAMETER, "[ERROR] Input handle is null");
+
+       char *new_engine_type = strdup(engine_type);
+       RETVM_IF(NULL == new_engine_type, TTS_ERROR_OUT_OF_MEMORY, "[ERROR] Fail to allocate memory for engine_type");
+
+       free(parameter->engine_type);
+       parameter->engine_type = new_engine_type;
+
+       SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set engine_type(%s) to a synthesis parameter", engine_type);
+       return TTS_ERROR_NONE;
+}
+
 int tts_get_pitch_range(tts_h tts, int* min, int* normal, int* max)
 {
        RETV_IF(TTS_ERROR_NONE != __tts_get_feature_enabled(), TTS_ERROR_NOT_SUPPORTED);
index 2de17462eb3b25fab9a0851794adb798b7f9c6da..6b2f2a884f331b3f962e977179932b3e7f0a1b53 100644 (file)
@@ -49,6 +49,7 @@ struct tts_synthesis_parameter_s {
        int pitch;
        double volume;
        double background_volume_ratio;
+       char *engine_type;
 };
 
 #ifdef __cplusplus
index ccbcf9e3ed01adbe3fe03990aa0e536bc72fce5d..fb2c7f635566b5d10ba2217e091eb2819ceb65b1 100644 (file)
@@ -770,8 +770,9 @@ int tts_tidl_request_add_text_with_synthesis_parameter(unsigned int uid, const c
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->pitch (%d)", parameter->pitch);
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->volume (%f)", parameter->volume);
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->background_volume_ratio (%f)", parameter->background_volume_ratio);
+       SLOG(LOG_DEBUG, TAG_TTSC, "parameter->engine_type(%s)", (parameter->engine_type) ? (parameter->engine_type) : "null");
 
-       int ret = rpc_port_proxy_tts_invoke_add_text_with_synthesis_parameter(info->rpc_h, uid, text, language, ptts_id, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio, uttid, not_null_credential);
+       int ret = rpc_port_proxy_tts_invoke_add_text_with_synthesis_parameter(info->rpc_h, uid, text, language, ptts_id, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio, parameter->engine_type, uttid, not_null_credential);
        int exception = get_last_result();
        if (RPC_PORT_ERROR_NONE != exception) {
                ret = __convert_and_handle_tidl_error(exception, info);
index 306470778cec2323fb74d3425f009fcd314fd937..54dca01471d800e1096ee87250234978d98b2e3e 100644 (file)
@@ -122,6 +122,23 @@ int tts_play_pcm(tts_h tts);
 */
 int tts_stop_pcm(tts_h tts);
 
+
+/**
+ * @brief Sets the engine_type.
+ * @since_tizen 9.0
+ * @param[in] parameter The TTS synthesis parameter handle
+ * @param[in] engine_type The TTS engine's type
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+ * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
+*/
+int tts_synthesis_parameter_set_engine_type(tts_synthesis_parameter_h parameter, const char *engine_type);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/ttse_internal.h b/include/ttse_internal.h
new file mode 100755 (executable)
index 0000000..9def997
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+*  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+
+#ifndef __TTSE_INTERNAL_H__
+#define __TTSE_INTERNAL_H__
+
+
+#include <ttse.h>
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+* @brief Called when the engine service user sets the engine_type of synthesized speech.
+* @since_tizen 9.0
+* @remarks This callback function is optional and is registered using ttse_set_engine_type_set_cb().
+* @param[in] engine_type The engine_type of synthesized speech
+* @param[in] user_data The user data to be passed to the callback function
+* @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_engine_type_cb)(const char* engine_type, void* user_data);
+
+
+
+
+/**
+* @brief Sets a callback function to be called when the engine_type of synthesized speech is set.
+* @since_tizen 9.0
+* @remarks The ttse_set_engine_type_cb() function is called when the engine service user sets the engine_type of synthesized speech.
+* @param[in] callback ttse_set_engine_type_cb event callback function
+* @param[in] user_data The user data passed from engine
+* @return @c 0 on success,
+*         otherwise a negative error value
+* @retval #TTSE_ERROR_NONE Successful
+* @retval #TTSE_ERROR_NOT_SUPPORTED TTS NOT supported
+* @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
+* @retval #TTSE_ERROR_INVALID_STATE Not initialized
+* @pre The ttse_main() function should be invoked before this function is called.
+* @see ttse_set_engine_type_cb()
+*/
+int ttse_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/**
+ * @}
+ */
+
+
+#endif /* __TTSE_INTERNAL_H__ */
index 8c25dc286790f5d9674d87d7d6923d260b576570..fe1eb2a22e9c0aaf51e4b93bb20d4b7fd4d6d3de 100644 (file)
@@ -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, 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* 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, const char* engine_type, int utt_id, bool is_silent, unsigned int duration_in_msec)
 {
        speak_data_s* speak_data = new speak_data_s();
        if (nullptr == speak_data) {
@@ -517,7 +517,13 @@ speak_data_s* ttsd_data_create_speak_data(const char* text, const char* language
        speak_data->synth_parameter.speed = speed;
        speak_data->synth_parameter.pitch = pitch;
        speak_data->synth_parameter.volume = volume;
-       speak_data->synth_parameter.background_volume_ratio = background_volume_ratio;
+       speak_data->synth_parameter.background_volume_ratio = bg_volume;
+       if (engine_type == NULL) {
+               speak_data->synth_parameter.engine_type = nullptr;
+               SLOG(LOG_INFO, tts_tag(), "[DATA INFO] engine_type of synth_parameter is null");
+       } else {
+               speak_data->synth_parameter.engine_type = strdup(engine_type);
+       }
 
        speak_data->utt_id = utt_id;
        speak_data->is_silent = is_silent;
index 4205183fe8e4897923dfd1b625b1e91c07827175..80d09e008430bb034360dcb4354ddedc7b589055 100644 (file)
@@ -48,6 +48,7 @@ typedef struct {
        int pitch;
        double volume;
        double background_volume_ratio;
+       char* engine_type;
 } synthesis_parameter_s;
 
 typedef struct {
@@ -99,7 +100,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, const char* ptts_id, 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, const char* engine_type, int utt_id, bool is_silent, unsigned int duration_in_msec);
 
 void ttsd_data_destroy_speak_data(speak_data_s* speak_data);
 
index 1f0d4ce8ed08e058f1d912ff447bba95d5095723..6f8e55daa71262602af8e9a9a4db77b3f7430a68 100644 (file)
@@ -193,6 +193,7 @@ static int __set_engine_callback(ttse_request_callback_s* callback, ttsengine_in
        engine_info->callbacks->private_data_requested = NULL;
        engine_info->callbacks->activated_mode_changed = NULL;
        engine_info->callbacks->set_personal_tts_id = NULL;
+       engine_info->callbacks->set_engine_type = NULL;
 
        SLOG(LOG_DEBUG, tts_tag(), "--- Valid Engine ---");
        SLOG(LOG_DEBUG, tts_tag(), "Engine uuid : %s", engine_info->engine_uuid);
@@ -885,6 +886,36 @@ int ttsd_engine_agent_set_personal_tts_id(const char* ptts_id)
        return TTSD_ERROR_NONE;
 }
 
+int ttsd_engine_agent_set_engine_type(const char* engine_type)
+{
+       if (NULL == engine_type) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] engine_type 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;
+       }
+
+       if (NULL == g_engine_info->callbacks->set_engine_type) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Setting engine_type is not supported. Fail to set engine_type.");
+               return TTSD_ERROR_NOT_SUPPORTED_FEATURE;
+       }
+
+       void* data = g_engine_info->callbacks->set_engine_type_user_data;
+       ret = g_engine_info->callbacks->set_engine_type(engine_type, data);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to set engine_type : engine_type(%s), result(%s)",
+                        engine_type, __ttsd_get_engine_error_code(ret));
+               return TTSD_ERROR_OPERATION_FAILED;
+       }
+
+       SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Set engine_type(%s)", engine_type);
+       return TTSD_ERROR_NONE;
+}
+
 int ttsd_engine_agent_is_credential_needed(unsigned int uid, bool* credential_needed)
 {
        if (NULL == credential_needed) {
@@ -1418,5 +1449,18 @@ int ttsd_engine_agent_set_personal_tts_id_set_cb(ttse_personal_tts_id_set_cb cal
 
        g_engine_info->callbacks->set_personal_tts_id = callback;
 
+       return TTSD_ERROR_NONE;
+}
+
+int ttsd_engine_agent_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data)
+{
+       if (false == __is_agent_initialized()) {
+               SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Not Initialized");
+               return TTSD_ERROR_INVALID_STATE;
+       }
+
+       g_engine_info->callbacks->set_engine_type = callback;
+       g_engine_info->callbacks->set_engine_type_user_data = user_data;
+
        return TTSD_ERROR_NONE;
 }
\ No newline at end of file
index 366ee388fde1f71ba2ee2fca3e6a28c323fe1772..a9033a3a24cdf432c799aafd26e0f15bcf9ae836 100644 (file)
@@ -41,6 +41,7 @@ int ttsd_engine_agent_set_private_data_set_cb(ttse_private_data_set_cb callback)
 int ttsd_engine_agent_set_private_data_requested_cb(ttse_private_data_requested_cb callback);
 int ttsd_engine_agent_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
 int ttsd_engine_agent_set_personal_tts_id_set_cb(ttse_personal_tts_id_set_cb callback);
+int ttsd_engine_agent_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data);
 
 /** Unload current engine */
 int ttsd_engine_agent_unload_current_engine();
@@ -63,6 +64,8 @@ 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_set_engine_type(const char* engine_type);
+
 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);
index 68908f976fa6f0b1106a24fcdd3ff23976fe9241..43287ff3c929e89a54ed9c57c9ee251188077ac6 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 
 #include "ttse.h"
+#include "ttse_internal.h"
 #include "tts_defs.h"
 
 #ifdef __cplusplus
@@ -113,6 +114,8 @@ typedef struct {
        ttse_private_data_requested_cb          private_data_requested;
        ttse_activated_mode_changed_cb          activated_mode_changed;
        ttse_personal_tts_id_set_cb             set_personal_tts_id;
+       ttse_set_engine_type_cb                 set_engine_type;
+       void*                                   set_engine_type_user_data;
 } tts_engine_callback_s;
 
 
index 51e835259e33d5556193ff8ee891b8b1295bc2d3..1ce662cbf2afaaf0b49df67625cc48dab0ead58f 100644 (file)
@@ -187,7 +187,6 @@ static void __synthesis(unsigned int uid)
                        __stop_and_send_ready_state(uid);
                }
        } else {
-
                if (NULL == speak_data->voice.language || NULL == speak_data->text) {
                        SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Current data is NOT valid");
                        __stop_and_send_ready_state(uid);
@@ -200,8 +199,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), 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(), "Voice : language(%s), type(%d), ptts_id(%s), speed(%d), engine_type(%s)", speak_data->voice.language,
+                       speak_data->voice.type, speak_data->voice.ptts_id, speak_data->synth_parameter.speed, speak_data->synth_parameter.engine_type);
                SLOG(LOG_INFO, tts_tag(), "Text : %s", speak_data->text);
                SLOG(LOG_INFO, tts_tag(), "Credential : %s", credential);
                SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------");
@@ -218,6 +217,11 @@ static void __synthesis(unsigned int uid)
                        SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] * FAIL to set personal tts id !!!! * ");
                }
 
+               ret = ttsd_engine_agent_set_engine_type(speak_data->synth_parameter.engine_type);
+               if (TTSD_ERROR_NONE != ret) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] * FAIL to set engine_type !!!! * ");
+               }
+
                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) {
@@ -1127,7 +1131,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, NULL, 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, NULL, utt_id, false, 0);
        if (NULL == speak_data) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
                if (NULL != temp_lang) {
@@ -1205,7 +1209,7 @@ int ttsd_server_add_text(unsigned int uid, const char* text, const char* lang, i
        return TTSD_ERROR_NONE;
 }
 
-int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char* text, const char* lang, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, int utt_id, const char* credential)
+int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char* text, const char* lang, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, const char* engine_type, int utt_id, const char* credential)
 {
        app_tts_state_e state = ttsd_data_get_client_state(uid);
        if (APP_STATE_NONE == state) {
@@ -1239,7 +1243,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, ptts_id, 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, engine_type, utt_id, false, 0);
        if (NULL == speak_data) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
                if (NULL != temp_lang) {
@@ -1254,7 +1258,7 @@ int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char*
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
-       SLOG(LOG_INFO, tts_tag(), "[Server] Add queue, lang(%s), vctype(%d), speed(%d), uttid(%d), credential(%s)", lang, voice_type, speed, utt_id, credential);
+       SLOG(LOG_INFO, tts_tag(), "[Server] Add queue, lang(%s), vctype(%d), speed(%d), engine_type(%s), uttid(%d), credential(%s)", lang, voice_type, speed, (engine_type) ? engine_type : "NULL", utt_id, credential);
 
        /* if state is APP_STATE_READY , APP_STATE_PAUSED , only need to add speak data to queue*/
        int ret = -1;
@@ -1325,7 +1329,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, NULL, 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, NULL, 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;
@@ -1685,6 +1689,16 @@ int ttsd_send_personal_voice(const char* language, const char* unique_id, const
        return ret;
 }
 
+int ttsd_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data)
+{
+       int ret = ttsd_engine_agent_set_engine_type_set_cb(callback, user_data);
+       if (TTSD_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set engine_type set cb : ret(%d)", ret);
+       }
+
+       return ret;
+}
+
 int ttsd_server_play_pcm(unsigned int uid)
 {
        app_tts_state_e state = ttsd_data_get_client_state(uid);
index e4aa647fee2c24491acfd5229c9305505f443c6b..39b5b4adfe563c203acea507506b9429fb358622 100644 (file)
@@ -19,6 +19,7 @@
 #include <Ecore.h>
 
 #include "ttse.h"
+#include "ttse_internal.h"
 #include "tts_ipc_method.h"
 
 #ifdef __cplusplus
@@ -44,9 +45,10 @@ int ttsd_get_activated_mode(int* activated_mode);
 int ttsd_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
 
 int ttsd_set_personal_tts_id_set_cb(ttse_personal_tts_id_set_cb callback, void* user_data);
-
 int ttsd_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name);
 
+int ttsd_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data);
+
 
 /*
 * Server API for client
@@ -68,7 +70,7 @@ int ttsd_server_add_text(unsigned int uid, const char* text, const char* lang, i
 
 int ttsd_server_add_silent_utterance(unsigned int uid, unsigned int duration_in_msec, int utt_id, const char* credential);
 
-int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char* text, const char* lang, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, int utt_id, const char* credential);
+int ttsd_server_add_text_with_synthesis_parameter(unsigned int uid, const char* text, const char* lang, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, const char* engine_type, int utt_id, const char* credential);
 
 int ttsd_server_play(unsigned int uid, const char* credential);
 
index fcc2d5f611e2400f53057fb89d7a990ca6dfe98c..4534d743526df5c6c11776e92caaec2bfa2c2e58 100644 (file)
@@ -351,12 +351,12 @@ static int __add_silent_utterance_cb(rpc_port_stub_tts_context_h context, int ui
        return TTSD_ERROR_NONE;
 }
 
-static int __add_text_with_synthesis_parameter_cb(rpc_port_stub_tts_context_h context, int uid, const char *text, const char* language, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, int uttid, const char *credential, void *user_data)
+static int __add_text_with_synthesis_parameter_cb(rpc_port_stub_tts_context_h context, int uid, const char *text, const char* language, const char* ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume_ratio, const char* engine_type, int uttid, const char *credential, void *user_data)
 {
        unsigned int u_uid = (unsigned int)uid;
        SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD TEXT WITH SYNTHESIS PARAMETER(%u)", u_uid);
 
-       int ret = ttsd_server_add_text_with_synthesis_parameter(u_uid, text, language, ptts_id, voice_type, speed, pitch, volume, background_volume_ratio, uttid, credential);
+       int ret = ttsd_server_add_text_with_synthesis_parameter(u_uid, text, language, ptts_id, voice_type, speed, pitch, volume, background_volume_ratio, engine_type, uttid, credential);
        if (TTSD_ERROR_NONE != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] TTS ADD TEXT WITH SYNTHESIS PARAMETER (%u) fail (%d/%s) <<<<<", u_uid, ret, get_error_message(ret));
                return ret;
index d67f54eca848ca83d8d8345284d9006c772b42e6..2ccd2cd65a4670e0e6855a8e781aa12a76515ff4 100755 (executable)
@@ -25,6 +25,7 @@
 #include <system_info.h>
 
 #include "ttse.h"
+#include "ttse_internal.h"
 
 static int g_feature_enabled = -1;
 static bool g_is_terminated = false;
@@ -388,3 +389,27 @@ int ttse_set_personal_tts_id_set_cb(ttse_personal_tts_id_set_cb callback, void*
 
        return ret;
 }
+
+int ttse_set_engine_type_set_cb(ttse_set_engine_type_cb callback, void* user_data)
+{
+       if (false == is_feature_enabled()) {
+               return TTSE_ERROR_NOT_SUPPORTED;
+       }
+
+       if (NULL == callback) {
+               SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid parameter");
+               return TTSE_ERROR_INVALID_PARAMETER;
+       }
+
+       if (false == g_is_started) {
+               SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is not started.");
+               return TTSE_ERROR_INVALID_STATE;
+       }
+
+       int ret = ttsd_set_engine_type_set_cb(callback, user_data);
+       if (TTSD_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to set engine_type set cb. ret(%d/%s)", ret, get_error_message(ret));
+       }
+
+       return ret;
+}
\ No newline at end of file
index 607f4283b37c295663405bba8717240215a31faf..533a5356032d9a50434d55210b877d7898968a2f 100644 (file)
@@ -6,6 +6,7 @@ struct tts_synthesis_parameter_s {
        int pitch;
        double volume;
        double background_volume;
+       string engine_type;
 }
 
 interface tts {
@@ -17,7 +18,7 @@ interface tts {
        int finalize(in int uid);
        int add_text(int uid, string text, string lang, int vctype, int speed, int uttid, string credential);
        int add_silent_utterance(int uid, int duration_in_msec, int uttid, string credential);
-       int add_text_with_synthesis_parameter(int uid, string text, string langauge, string ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume, int uttid, string credential);
+       int add_text_with_synthesis_parameter(int uid, string text, string langauge, string ptts_id, int voice_type, int speed, int pitch, double volume, double background_volume, string engine_type, int uttid, string credential);
        int stop(in int uid);
        int pause(in int uid);
        int play_pcm(in int uid);