fix sound type issue
authorHyejin Kim <hyejin0906.kim@samsung.com>
Tue, 11 Sep 2012 06:14:36 +0000 (15:14 +0900)
committerHyejin Kim <hyejin0906.kim@samsung.com>
Tue, 11 Sep 2012 06:14:36 +0000 (15:14 +0900)
resource/media-data-sdk/settings/Alerts/General notification_sdk.wav [changed mode: 0755->0644]
setting-profile/src/setting-profile-sound-main.c
setting-profile/src/setting-profile.c

old mode 100755 (executable)
new mode 100644 (file)
index 6487389..6b0cca4
Binary files a/resource/media-data-sdk/settings/Alerts/General notification_sdk.wav and b/resource/media-data-sdk/settings/Alerts/General notification_sdk.wav differ
index 5297b04..857434e 100755 (executable)
@@ -232,88 +232,6 @@ static void __mm_player_msg_cb(void *user_param)
        setting_profile_close_all_mm_players(ad);
 }
 
-Eina_Bool __volume_timer_cb(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       retv_if(data == NULL, EINA_FALSE);
-       SettingProfileUG *ad = (SettingProfileUG *)data;
-       double value = 0.0;
-
-       SETTING_TRACE_DEBUG("cur_vol_type : %d", ad->cur_vol_type);
-
-       switch(ad->cur_vol_type)
-       {
-               case SETTING_VOL_TYPE_RINGTONE:
-                       if(ad->data_call_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_call_volume->eo_check);
-                               sound_manager_set_volume(SOUND_TYPE_RINGTONE, (unsigned int)(value+0.5));
-                               setting_profile_change_player_volume(&ad->mp_ringtone, value);
-                       }
-                       break;
-               case SETTING_VOL_TYPE_NOTIFICATION:
-                       if(ad->data_noti_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_noti_volume->eo_check);
-                               sound_manager_set_volume(SOUND_TYPE_NOTIFICATION, (unsigned int)(value+0.5));
-                               setting_profile_change_player_volume(&ad->mp_noti, value);
-                       }
-                       break;
-               case SETTING_VOL_TYPE_MEDIA:
-                       if(ad->data_media_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_media_volume->eo_check);
-                               sound_manager_set_volume(SOUND_TYPE_MEDIA, (unsigned int)(value+0.5));
-                               setting_profile_change_player_volume(&ad->mp_media, value);
-                       }
-                       break;
-               case SETTING_VOL_TYPE_SYSTEM:
-                       if(ad->data_touch_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_touch_volume->eo_check);
-                               sound_manager_set_volume(SOUND_TYPE_SYSTEM, (unsigned int)(value+0.5));
-                               setting_profile_change_player_volume(&ad->mp_sys, value);
-                       }
-                       break;
-               case SETTING_VOL_TYPE_NOTI_VIB:
-                       if(ad->data_vib_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_vib_volume->eo_check);
-                               vconf_set_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, (unsigned int)(value+0.5));
-                       }
-                       break;
-               case SETTING_VOL_TYPE_HAPTIC_VIB:
-                       if(ad->data_touch_vib)
-                       {
-                               value = elm_slider_value_get(ad->data_touch_vib->eo_check);
-                               vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, (unsigned int)(value+0.5));
-                               //It must change synchronizly to avoid the unexpected terminate issue
-                               vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_BAK_INT, (unsigned int)(value+0.5));
-                       }
-                       break;
-               default:
-                       break;
-
-       }
-       return ECORE_CALLBACK_RENEW;
-}
-
-void __create_volume_timer(void *data, setting_volume_types type)
-{
-       SETTING_TRACE_BEGIN;
-       ret_if(data == NULL);
-
-       SettingProfileUG *ad = (SettingProfileUG *)data;
-
-       if(ad->volume_timer)
-       {
-               ecore_timer_del(ad->volume_timer);
-               ad->volume_timer = NULL;
-               SETTING_TRACE_DEBUG("[AA] volume timer is deleted");
-       }
-       ad->volume_timer = ecore_timer_add(SETTING_SOUND_VOLUME_TIMER_INTERVAL, (Ecore_Task_Cb)__volume_timer_cb, ad);
-}
-
 void __ringtone_start_change_cb(void *data, Evas_Object *obj, void *event_info)
 {
        ret_if(data == NULL);
@@ -355,29 +273,6 @@ void __system_start_change_cb(void *data, Evas_Object *obj, void *event_info)
        setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_SYSTEM);
 }
 
-void __noti_vib_start_change_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       ret_if(data == NULL);
-
-       Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
-       SettingProfileUG *ad = list_item->userdata;
-
-       ad->cur_vol_type = SETTING_VOL_TYPE_NOTI_VIB;
-       setting_profile_close_all_mm_players(ad);
-}
-
-void __haptic_vib_start_change_cb(void *data, Evas_Object *obj, void *event_info)
-       {
-       SETTING_TRACE_BEGIN;
-       ret_if(data == NULL);
-
-       Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
-       SettingProfileUG *ad = list_item->userdata;
-
-       ad->cur_vol_type = SETTING_VOL_TYPE_HAPTIC_VIB;
-       setting_profile_close_all_mm_players(ad);
-}
-
 void __volume_stop_change_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
@@ -461,58 +356,11 @@ void __volume_stop_change_cb(void *data, Evas_Object *obj, void *event_info)
                return;
        }
 
-       __create_volume_timer(ad, ad->cur_vol_type);
-
        FREE(pa_tone_path);
 
        SETTING_TRACE_END;
 }
 
-void __vibration_stop_change_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       ret_if(data == NULL);
-
-       Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
-       SettingProfileUG *ad = list_item->userdata;
-
-       if (device_haptic_stop_play(ad->hnd_hpt) != 0) {
-               SETTING_TRACE("ERROR device_haptic_stop_play");
-               /* return; */
-       }
-
-       double value = 0.0;
-       switch(ad->cur_vol_type)
-       {
-               case SETTING_VOL_TYPE_NOTI_VIB:
-                       if(ad->data_vib_volume)
-                       {
-                               value = elm_slider_value_get(ad->data_vib_volume->eo_check);
-                               vconf_set_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, (unsigned int)(value+0.5));
-                               if(value < 0.5)
-                                       elm_slider_value_set(ad->data_vib_volume->eo_check, 0);
-                               else
-                                       elm_slider_value_set(ad->data_vib_volume->eo_check, (unsigned int)(value+0.5));
-                       }
-                       break;
-               case SETTING_VOL_TYPE_HAPTIC_VIB:
-                       if(ad->data_touch_vib)
-                       {
-                               value = elm_slider_value_get(ad->data_touch_vib->eo_check);
-                               vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, (unsigned int)(value+0.5));
-                               vconf_set_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_BAK_INT, (unsigned int)(value+0.5));
-                               if(value < 0.5)
-                                       elm_slider_value_set(ad->data_touch_vib->eo_check, 0);
-                               else
-                                       elm_slider_value_set(ad->data_touch_vib->eo_check, (unsigned int)(value+0.5));
-                       }
-                       break;
-               default:
-                       break;
-       }
-       ad->cur_vol_type = SETTING_VOL_TYPE_MAX;
-       SETTING_TRACE_END;
-}
-
 static Evas_Object *__get_main_list(void *data)
 {
        retv_if(data == NULL, NULL);
@@ -658,10 +506,6 @@ static Evas_Object *__get_main_list(void *data)
                SETTING_TRACE_ERROR("ad->data_touch_volume is NULL");
        }
 
-       (void)setting_create_Gendial_field_titleItem(genlist,
-                                                    &(ad->itc_group_item),
-                                                    "IDS_ST_BODY_CALLALERTTYPE_VIBRATION", NULL);
-
        setting_create_Gendial_field_def(genlist, &(ad->itc_bg_1icon),
                                         NULL, ad,
                                         SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
@@ -1359,6 +1203,7 @@ setting_profile_sound_main_call_ringtone_sound_slider_value_change_cb(void *data
        if(list_item->chk_status != (int)(val+0.5))
        {
                list_item->chk_status = (int)(val+0.5);
+               sound_manager_set_volume(SOUND_TYPE_RINGTONE, (unsigned int)list_item->chk_status);
                SETTING_TRACE_DEBUG("ringtone volume is %d, %f", list_item->chk_status, val);
        }
 }
@@ -1382,6 +1227,8 @@ setting_profile_sound_main_noti_sound_slider_value_change_cb(void *data,
        if(list_item->chk_status != (int)(val+0.5))
        {
                list_item->chk_status = val;
+               sound_manager_set_volume(SOUND_TYPE_NOTIFICATION, (unsigned int)list_item->chk_status);
+               SETTING_TRACE_DEBUG("notification volume is %d, %f", list_item->chk_status, val);
        }
 }
 
@@ -1403,6 +1250,8 @@ setting_profile_sound_main_media_sound_slider_value_change_cb(void *data,
        if(list_item->chk_status != (int)(val+0.5))
        {
                list_item->chk_status = val;
+               sound_manager_set_volume(SOUND_TYPE_MEDIA, (unsigned int)list_item->chk_status);
+               SETTING_TRACE_DEBUG("media volume is %d, %f", list_item->chk_status, val);
        }
 }
 
@@ -1425,74 +1274,8 @@ settings_profile_sound_main_sys_sound_slider_value_change_cb(void *data,
        if(list_item->chk_status != (int)(val+0.5))
        {
                list_item->chk_status = val;
+               sound_manager_set_volume(SOUND_TYPE_SYSTEM, (unsigned int)list_item->chk_status);
+               SETTING_TRACE_DEBUG("system volume is %d, %f", list_item->chk_status, val);
        }
 }
 
-static void
-setting_profile_sound_main_vib_sound_slider_value_change_cb(void *data,
-                                                           Evas_Object *obj,
-                                                           void *event_info)
-{
-       /* error check */
-       ret_if(data == NULL);
-
-       static double priv_val_db = 5.0;
-       static int priv_val_int = 0;
-       double val = elm_slider_value_get(obj);
-       SETTING_TRACE("val = %f", val);
-       Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
-       SettingProfileUG *ad = list_item->userdata;
-       list_item->chk_status = val;
-
-       int value;
-       int err;
-
-       value = (int)(val + 0.5);       /*  to sync displayed value on slider */
-       if (value != priv_val_int) {
-               int vib_volume = value;
-               device_haptic_stop_play(ad->hnd_hpt);
-               err = device_haptic_play_monotone_with_feedback_level(ad->hnd_hpt, 1000, vib_volume);
-
-               if (err < 0)
-                       SETTING_TRACE("Failed to play haptic monotone");
-               priv_val_int = value;
-       }
-       priv_val_db = val;
-
-}
-
-static void
-setting_profile_sound_main_touchVib_sound_slider_value_change_cb(void *data,
-                                                                Evas_Object *
-                                                                obj, void
-                                                                *event_info)
-{
-       /* error check */
-       ret_if(data == NULL);
-
-       static double priv_val_db = 3.0;
-       static int priv_val_int = 0;
-       double val = elm_slider_value_get(obj);
-       SETTING_TRACE("val = %f", val);
-       Setting_GenGroupItem_Data *list_item =
-           (Setting_GenGroupItem_Data *) data;
-       SettingProfileUG *ad = list_item->userdata;
-       list_item->chk_status = val;
-
-       int value;
-       int err;
-
-       value = (int)(val + 0.5);       /*  to sync displayed value on slider */
-       if (value != priv_val_int) {
-
-               int vib_volume = value; /* SETTING_VIB_VOL_MAX; */
-               device_haptic_stop_play(ad->hnd_hpt);
-               err = device_haptic_play_monotone_with_feedback_level(ad->hnd_hpt, 1000, vib_volume);
-
-               if (err < 0)
-                       SETTING_TRACE("Failed to play haptic monotone");
-               priv_val_int = value;
-       }
-       priv_val_db = val;
-}
-
index 61fba99..1d8e1a0 100755 (executable)
@@ -621,6 +621,15 @@ player_h *setting_profile_play_sound(void *data, void *cb,
                return NULL;
        }
 
+       err = player_set_sound_type(*player, sound_type);
+       if (err != PLAYER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("error to set sound_type[%d]", err);
+               player_destroy(*player);
+               free(player);
+               return NULL;
+       }
+       SETTING_TRACE_DEBUG("player_set_sound_type [%d]", ad->cur_vol_type);
+
        err = player_set_uri(*player, ad->song_playing);
        if (err != PLAYER_ERROR_NONE) {
                SETTING_TRACE_ERROR("error to set attribute---profile_uri[%d]", err);
@@ -663,12 +672,7 @@ player_h *setting_profile_play_sound(void *data, void *cb,
        SETTING_TRACE("waiting..");
        ad->playing_volume = vol;
 
-       float volumn = vol / VOLUME_DEN;
-       int ret = player_set_volume(*player, volumn, volumn);
-       if(ret != PLAYER_ERROR_NONE)
-               SETTING_TRACE_ERROR("failed to set volume of player [%d]", ret);
-
-       SETTING_TRACE_DEBUG("playing volume is %f", volumn);
+       SETTING_TRACE_DEBUG("playing volume is %d", ad->playing_volume);
 
        return player;
 }