Added set/unset background volume ratio fucntion.
[platform/core/uifw/tts.git] / server / ttsd_server.c
index c1b5ab8..6a4e6e2 100644 (file)
@@ -294,7 +294,7 @@ bool __get_client_cb(int pid, int uid, app_tts_state_e state, void* user_data)
        return true;
 }
 
-void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_param)
+void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_param, double double_param)
 {
        switch (type) {
        case TTS_CONFIG_TYPE_ENGINE:
@@ -383,6 +383,19 @@ void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_
                }
                break;
        }
+
+       case TTS_CONFIG_TYPE_BACKGROUND_VOLUME_RATIO:
+       {
+               if (0.0 <= double_param && double_param <= 1.0) {
+                       /* set default bg volume ratio */
+                       int ret = 0;
+                       ret = ttsd_player_set_background_volume_ratio(double_param);
+                       if (0 != ret) {
+                               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set default bg volume ratio : result(%d)", ret);
+                       }
+               }
+               break;
+       }
        }
 
        return;
@@ -423,6 +436,17 @@ int ttsd_initialize(ttse_request_callback_s *callback)
                SLOG(LOG_ERROR, tts_tag(), "[Server WARNING] Fail to initialize config.");
        }
 
+       double ratio;
+       if (0 == ttsd_config_get_bg_volume_ratio(&ratio))
+       {
+               SLOG(LOG_ERROR, tts_tag(), "[Server] get bg volume ratio is %lf", ratio);
+               int ret = ttsd_player_set_background_volume_ratio(ratio);
+               if (0 != ret)
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set bg volume ratio : result(%d)", ret);
+       }
+       else
+               SLOG(LOG_ERROR, tts_tag(), "[Server WARNING] Fail to get bg volume ratio");
+
        /* player init */
        if (ttsd_player_init()) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to initialize player init.");