int before_type = config_info.type;
set_voice_into_config(&config_info, lang, voice_type);
- SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] Voice change(%s, %d)", config_info.language, config_info.type);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] Voice change(%s, %d) from (%s, %d)", config_info.language, config_info.type, before_lang, before_type);
/* Call all callbacks of client*/
if (NULL != before_lang) {
static int set_voice_by_automation(int allowed_type_flag)
{
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] set_voice_by_automation");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
char* display_language = vconf_get_str(TTS_LANGSET_KEY);
if (NULL == display_language) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config ERROR] Fail to get display language");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
char* tmp_language = NULL;
int tmp_type = TTS_CONFIG_VOICE_TYPE_NONE;
if (0 != __tts_config_mgr_select_lang(config_info.engine_id, &tmp_language, &tmp_type)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to select language");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
if (NULL == tmp_language) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] language is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config INFO] Select default voice : lang(%s) type(%d)", selected_language, selected_type);
if (__is_client_type(allowed_type_flag)) {
if (0 != tts_parser_set_voice(selected_language, selected_type)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to save config");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_voice_changed_event(config_info.language, config_info.type, selected_language, selected_type, config_info.auto_voice);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] voice changed event was invoked. language(%s), type(%d), selected language(%s), selected type(%d), auto_voice(%d)", config_info.language, config_info.type, selected_language, selected_type, (int)config_info.auto_voice);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client is not allowed to save configuration. Skip saving configuration file.");
}
+ close(fd);
+
set_voice_into_config(&config_info, selected_language, selected_type);
if (0 != tts_parser_set_config_info(&config_info)){
int tts_config_mgr_initialize(unsigned int uid, tts_config_client_type_e client_type)
{
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_initialize");
/* Register uid */
if (0 < g_slist_length(g_config_client_list)) {
/* Check uid */
__tts_config_mgr_print_engine_info();
- if (0 != tts_parser_load_config()) {
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse configure information");
release_config_client(uid);
__tts_config_release_engine();
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
+ close(fd);
release_config_client(uid);
__tts_config_release_engine();
return TTS_CONFIG_ERROR_OPERATION_FAILED;
/* Check whether engine id is valid */
if (0 != __tts_config_mgr_check_engine_is_valid(config_info.engine_id)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get default engine");
+ close(fd);
release_config_client(uid);
__tts_config_release_engine();
tts_parser_unload_config();
if (true == config_info.auto_voice) {
/* Check language with display language */
+ close(fd);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] call set_voice_by_automation");
set_voice_by_automation(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT);
} else {
if (false == __tts_config_mgr_check_lang_is_valid(config_info.engine_id, config_info.language, config_info.type)) {
int tmp_type = -1;
if (0 != __tts_config_mgr_select_lang(config_info.engine_id, &tmp_language, &tmp_type)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to select language");
+ close(fd);
release_config_client(uid);
__tts_config_release_engine();
tts_parser_unload_config();
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_voice(config_info.language, config_info.type)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to save config");
+ close(fd);
release_config_client(uid);
__tts_config_release_engine();
tts_parser_unload_config();
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
if (0 != tts_parser_set_config_info(&config_info)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
+ close(fd);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
}
}
+ close(fd);
}
+
/* print daemon config */
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@ TTS config @@@");
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " engine : %s", config_info.engine_id);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " setting : %s", config_info.setting);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " auto voice : %s", config_info.auto_voice ? "on" : "off");
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " language : %s", config_info.language);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " voice type : %d", config_info.type);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " speech rate : %d", config_info.speech_rate);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " pitch : %d", config_info.pitch);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " bg volume ratio : %lf", config_info.bg_volume_ratio);
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@@@");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "@@@ TTS config @@@");
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " engine : %s", config_info.engine_id);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " setting : %s", config_info.setting);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " auto voice : %s", config_info.auto_voice ? "on" : "off");
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " language : %s", config_info.language);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " voice type : %d", config_info.type);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " speech rate : %d", config_info.speech_rate);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " pitch : %d", config_info.pitch);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, " bg volume ratio : %lf", config_info.bg_volume_ratio);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "@@@@@");
if (0 != __tts_config_mgr_register_config_event()) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to register config event");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_engine");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
if (0 == strcmp(config_info.engine_id, engine)) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Engine id(%s) is not changed. Skip setting", engine);
+ close(fd);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Engine id(%s) is not changed. Skip setting", engine);
return TTS_CONFIG_ERROR_NONE;
}
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "New engine id : %s", engine);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] New engine id : %s", engine);
ret = __tts_set_buxtonkey(engine);
if (0 != ret) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] set_buxtonkey Fail!!");
+ close(fd);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] set_buxtonkey Fail!!");
return ret;
}
tts_engine_info_s *engine_info = __get_engine_info(engine);
if (NULL == engine_info) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Engine id(%s) is not valid", engine);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
}
}
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Engine changed");
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Engine : %s", config_info.engine_id);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Setting : %s", config_info.setting);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Language : %s", config_info.language);
- SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Type : %d", config_info.type);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[Config] Engine changed");
+ SECURE_SLOG(LOG_INFO, TAG_TTSCONFIG, " Engine : %s", config_info.engine_id);
+ SECURE_SLOG(LOG_INFO, TAG_TTSCONFIG, " Setting : %s", config_info.setting);
+ SECURE_SLOG(LOG_INFO, TAG_TTSCONFIG, " Language : %s", config_info.language);
+ SECURE_SLOG(LOG_INFO, TAG_TTSCONFIG, " Type : %d", config_info.type);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_engine(config_info.engine_id, config_info.setting,
config_info.language, config_info.type)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, " Fail to save config");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_engine_changed_event(config_info.engine_id, config_info.setting, config_info.language, config_info.type, config_info.auto_voice, config_info.credential);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
+ close(fd);
+
if (0 != tts_parser_set_config_info(&config_info)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_voice");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
if (0 == strcmp(config_info.language, language) && config_info.type == type) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Voice(%s/%d) is not changed. Skip setting", language, type);
+ close(fd);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Voice(%s/%d) is not changed. Skip setting", language, type);
return TTS_CONFIG_ERROR_NONE;
}
char* default_engine = get_default_engine_app_id();
tts_engine_info_s *engine_info = __get_engine_info(default_engine);
if (NULL == engine_info) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Current engine(%s) is not valid", default_engine);
free(default_engine);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
tts_config_voice_s *voice = __get_voice_info(engine_info, language, type);
if (NULL == voice) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Voice(%s/%d) is not valid in current engine", language, type);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
/* Check language is valid */
- SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config INFO] Select default voice : lang(%s) type(%d)", language, type);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config INFO] Select default voice : lang(%s) type(%d), prev(%s, %d)", language, type, config_info.language, config_info.type);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_voice(language, type)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save default voice");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_voice_changed_event(config_info.language, config_info.type, language, type, config_info.auto_voice);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
+ close(fd);
+
set_voice_into_config(&config_info, language, type);
if (0 != tts_parser_set_config_info(&config_info)){
return TTS_CONFIG_ERROR_INVALID_STATE;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_auto_voice");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
if (config_info.auto_voice == value) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Auto voice option(%s) is not changed. Skip setting", (value ? "True" : "False"));
+ close(fd);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Auto voice option(%s) is not changed. Skip setting", (value ? "True" : "False"));
return TTS_CONFIG_ERROR_NONE;
}
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config INFO] set auto voice : %d, prev(%d)", value, config_info.auto_voice);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_auto_voice(value)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save auto voice option");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+
+ tts_parser_save_with_flock(fd);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
+ close(fd);
+
config_info.auto_voice = value;
if (0 != tts_parser_set_config_info(&config_info)) {
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
}
if (true == config_info.auto_voice) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] call set_voice_by_automation");
set_voice_by_automation(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT);
}
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_speech_rate");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
if (config_info.speech_rate == value) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Speech rate(%d) is not changed. Skip setting", value);
+ close(fd);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Speech rate(%d) is not changed. Skip setting", value);
return TTS_CONFIG_ERROR_NONE;
}
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Set speech rate : %d", value);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config] Set speech rate : %d, prev(%d)", value, config_info.speech_rate);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_speech_rate(value)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save speech rate");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_speech_rate_changed_event(value);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
+ close(fd);
+
config_info.speech_rate = value;
if (0 != tts_parser_set_config_info(&config_info)){
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
return ret;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_pitch");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
tts_config_s config_info;
if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
ret = __check_engine_support_pitch(config_info.engine_id);
if (TTS_CONFIG_ERROR_NONE != ret) {
+ close(fd);
return ret;
}
if (config_info.pitch == value) {
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Pitch(%d) is not changed. Skip setting", value);
+ close(fd);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Pitch(%d) is not changed. Skip setting", value);
return TTS_CONFIG_ERROR_NONE;
}
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config] Set pitch : %d, prev(%d)", value, config_info.pitch);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_pitch(value)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save pitch");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_pitch_changed_event(value);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
+ close(fd);
+
config_info.pitch = value;
if (0 != tts_parser_set_config_info(&config_info)){
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
return TTS_CONFIG_ERROR_INVALID_STATE;
}
- SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Set bg volume ratio : %lf", value);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[INFO] tts_config_mgr_set_bg_volume_ratio");
+ int fd = tts_parser_open_with_flock();
+ if (fd < 0) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open with flock");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
+ tts_config_s config_info;
+ if (0 != tts_parser_get_config_info(&config_info)){
+ close(fd);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config] Set bg volume ratio : %lf, prev(%lf)", value, config_info.bg_volume_ratio);
if (__is_client_type(TTS_CONFIG_CLIENT_TYPE_SETTING | TTS_CONFIG_CLIENT_TYPE_SERVER | TTS_CONFIG_CLIENT_TYPE_INTERRUPT)) {
if (0 != tts_parser_set_bg_volume_ratio(value)) {
+ close(fd);
SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save bg volume ratio");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
+ tts_parser_save_with_flock(fd);
invoke_bg_volume_ratio_changed_event(value);
} else {
SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
}
- tts_config_s config_info;
- if (0 != tts_parser_get_config_info(&config_info)){
- SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get configure information");
- return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ close(fd);
+
+ if (config_info.bg_volume_ratio == value) {
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "Background volume(%lf) is not changed. Skip setting", value);
+ return TTS_CONFIG_ERROR_NONE;
}
config_info.bg_volume_ratio = value;
-
if (0 != tts_parser_set_config_info(&config_info)){
SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
return TTS_CONFIG_ERROR_OPERATION_FAILED;