tts_config_speech_rate_changed_cb speech_cb;
tts_config_screen_reader_changed_cb screen_cb;
tts_config_pitch_changed_cb pitch_cb;
+ tts_config_bg_volume_ratio_changed_cb bg_volume_ratio_cb;
void* user_data;
} tts_config_client_s;
int voice_type = -1;
int speech_rate = -1;
int pitch = -1;
+ double bg_volume_ratio = -1;
GSList *iter = NULL;
tts_config_client_s* temp_client = NULL;
- if (0 != tts_parser_find_config_changed(&engine, &setting, &auto_voice, &lang, &voice_type, &speech_rate, &pitch))
+ if (0 != tts_parser_find_config_changed(&engine, &setting, &auto_voice, &lang, &voice_type, &speech_rate, &pitch, &bg_volume_ratio))
return ECORE_CALLBACK_PASS_ON;
/* engine changed */
}
}
+ if (-1 != bg_volume_ratio) {
+ g_config_info->bg_volume_ratio = bg_volume_ratio;
+
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "background volume ratio change(%lf)", g_config_info->bg_volume_ratio);
+
+ /* Call all callbacks of client*/
+ iter = g_slist_nth(g_config_client_list, 0);
+
+ while (NULL != iter) {
+ temp_client = iter->data;
+
+ if (NULL != temp_client) {
+ if (NULL != temp_client->bg_volume_ratio_cb) {
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "background volume ratio changed callback : uid(%d)", temp_client->uid);
+ temp_client->bg_volume_ratio_cb(g_config_info->bg_volume_ratio, temp_client->user_data);
+ }
+ }
+
+ iter = g_slist_next(iter);
+ }
+ }
+
if (NULL != engine) {
free(engine);
engine = NULL;
temp_client->speech_cb = NULL;
temp_client->pitch_cb = NULL;
temp_client->screen_cb = NULL;
+ temp_client->bg_volume_ratio_cb = NULL;
temp_client->user_data = NULL;
g_config_client_list = g_slist_append(g_config_client_list, temp_client);
temp_client->speech_cb = NULL;
temp_client->pitch_cb = NULL;
temp_client->screen_cb = NULL;
+ temp_client->bg_volume_ratio_cb = NULL;
temp_client->user_data = NULL;
g_config_client_list = g_slist_append(g_config_client_list, temp_client);
SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " voice type : %d", g_config_info->type);
SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " speech rate : %d", g_config_info->speech_rate);
SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " pitch : %d", g_config_info->pitch);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " bg volume ratio : %lf", g_config_info->bg_volume_ratio);
SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@@@");
if (0 != __tts_config_mgr_register_config_event()) {
tts_config_voice_changed_cb voice_cb,
tts_config_speech_rate_changed_cb speech_cb,
tts_config_pitch_changed_cb pitch_cb,
+ tts_config_bg_volume_ratio_changed_cb bg_volume_ratio_cb,
void* user_data)
{
GSList *iter = NULL;
temp_client->voice_cb = voice_cb;
temp_client->speech_cb = speech_cb;
temp_client->pitch_cb = pitch_cb;
+ temp_client->bg_volume_ratio_cb = bg_volume_ratio_cb;
temp_client->user_data = user_data;
}
}
temp_client->voice_cb = NULL;
temp_client->speech_cb = NULL;
temp_client->pitch_cb = NULL;
+ temp_client->bg_volume_ratio_cb = NULL;
temp_client->user_data = NULL;
}
}
return 0;
}
+int tts_config_mgr_get_bg_volume_ratio(double *value)
+{
+ if (0 >= g_slist_length(g_config_client_list)) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
+ return TTS_CONFIG_ERROR_INVALID_PARAMETER;
+ }
+
+ if (NULL == value)
+ return TTS_CONFIG_ERROR_INVALID_PARAMETER;
+ else
+ *value = g_config_info->bg_volume_ratio;
+
+ return 0;
+}
+
+int tts_config_mgr_set_bg_volume_ratio(double value)
+{
+ if (0 >= g_slist_length(g_config_client_list)) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
+ return TTS_CONFIG_ERROR_INVALID_PARAMETER;
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Set bg volume ratio : %lf", value);
+ if (0 != tts_parser_set_bg_volume_ratio(value))
+ {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save bg volume ratio");
+ return TTS_CONFIG_ERROR_OPERATION_FAILED;
+ }
+
+ g_config_info->bg_volume_ratio = value;
+
+ return 0;
+}
+
bool tts_config_check_default_engine_is_valid(const char* engine)
{
if (0 >= g_slist_length(g_config_client_list)) {