config - feature add - audio muting config and controls
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 9 Feb 2014 10:12:12 +0000 (19:12 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 9 Feb 2014 10:17:01 +0000 (19:17 +0900)
config/default/base.src
config/mobile/base.src
config/standard/base.src
src/bin/config.c
src/lib/elm_config.c
src/lib/elm_config.h
src/lib/elm_priv.h

index db85956..124f5bf 100644 (file)
@@ -80,6 +80,14 @@ group "Elm_Config" struct {
   value "auto_throttle_amount" double: 0.1;
   value "magnifier_enable" uchar: 1;
   value "magnifier_scale" double: 1.5;
+  value "audio_mute_effect" uchar: 0;
+  value "audio_mute_background" uchar: 0;
+  value "audio_mute_music" uchar: 0;
+  value "audio_mute_foreground" uchar: 0;
+  value "audio_mute_interface" uchar: 0;
+  value "audio_mute_input" uchar: 0;
+  value "audio_mute_alert" uchar: 0;
+  value "audio_mute_all" uchar: 0;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index afc58e1..f634b1d 100644 (file)
@@ -84,6 +84,14 @@ group "Elm_Config" struct {
   value "indicator_service_270" string: "elm_indicator_landscape";
   value "magnifier_enable" uchar: 1;
   value "magnifier_scale" double: 1.5;
+  value "audio_mute_effect" uchar: 0;
+  value "audio_mute_background" uchar: 0;
+  value "audio_mute_music" uchar: 0;
+  value "audio_mute_foreground" uchar: 0;
+  value "audio_mute_interface" uchar: 0;
+  value "audio_mute_input" uchar: 0;
+  value "audio_mute_alert" uchar: 0;
+  value "audio_mute_all" uchar: 0;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index 8bd58ae..cf61b79 100644 (file)
@@ -81,6 +81,14 @@ group "Elm_Config" struct {
   value "auto_throttle_amount" double: 0.0333333333;
   value "magnifier_enable" uchar: 0;
   value "magnifier_scale" double: 1.5;
+  value "audio_mute_effect" uchar: 0;
+  value "audio_mute_background" uchar: 0;
+  value "audio_mute_music" uchar: 0;
+  value "audio_mute_foreground" uchar: 0;
+  value "audio_mute_interface" uchar: 0;
+  value "audio_mute_input" uchar: 0;
+  value "audio_mute_alert" uchar: 0;
+  value "audio_mute_all" uchar: 0;
   group "color_palette" list {
      group "Elm_Custom_Palette" struct {
         value "palette_name" string: "default";
index db94b68..70b8ecc 100644 (file)
@@ -951,6 +951,14 @@ _cf_caches(void            *data,
 }
 
 static void
+_cf_audio(void *data,
+        Evas_Object *obj EINA_UNUSED,
+        void *event_info EINA_UNUSED)
+{
+   _flip_to(data,"audio");
+}
+
+static void
 _cf_etc(void *data,
         Evas_Object *obj EINA_UNUSED,
         void *event_info EINA_UNUSED)
@@ -1463,6 +1471,62 @@ _status_config_sizing(Evas_Object *win,
    elm_naviframe_item_simple_push(naviframe, bx);
 }
 
+#define MUTE_CB(_cb, _chan) \
+static void \
+_cb(void *data       EINA_UNUSED, \
+    Evas_Object     *obj, \
+    void *event_info EINA_UNUSED) \
+{ \
+   Eina_Bool val = elm_check_state_get(obj); \
+   Eina_Bool v = elm_config_audio_mute_get(_chan); \
+   if (val == v) return; \
+   elm_config_audio_mute_set(_chan, val); \
+   elm_config_all_flush(); \
+}
+
+MUTE_CB(mute_effect_change, EDJE_CHANNEL_EFFECT)
+MUTE_CB(mute_background_change, EDJE_CHANNEL_BACKGROUND)
+MUTE_CB(mute_music_change, EDJE_CHANNEL_MUSIC)
+MUTE_CB(mute_foreground_change, EDJE_CHANNEL_FOREGROUND)
+MUTE_CB(mute_interface_change, EDJE_CHANNEL_INTERFACE)
+MUTE_CB(mute_input_change, EDJE_CHANNEL_INPUT)
+MUTE_CB(mute_alert_change, EDJE_CHANNEL_ALERT)
+MUTE_CB(mute_all_change, EDJE_CHANNEL_ALL)
+
+static void
+_status_config_audio(Evas_Object *win,
+                     Evas_Object *naviframe)
+{
+   Evas_Object *bx, *ck;
+
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+#define MUTE_CHECK(_label, _chan, _cb)  \
+   ck = elm_check_add(win); \
+   elm_object_text_set(ck, _label); \
+   evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); \
+   evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); \
+   elm_check_state_set(ck, elm_config_audio_mute_get(_chan)); \
+   elm_box_pack_end(bx, ck); \
+   evas_object_show(ck); \
+   evas_object_smart_callback_add(ck, "changed", _cb, NULL);
+
+   MUTE_CHECK("Mute Effects", EDJE_CHANNEL_EFFECT, mute_effect_change);
+   MUTE_CHECK("Mute Background", EDJE_CHANNEL_BACKGROUND, mute_background_change);
+   MUTE_CHECK("Mute Music", EDJE_CHANNEL_MUSIC, mute_music_change);
+   MUTE_CHECK("Mute Foreground", EDJE_CHANNEL_FOREGROUND, mute_foreground_change);
+   MUTE_CHECK("Mute Interface", EDJE_CHANNEL_INTERFACE, mute_interface_change);
+   MUTE_CHECK("Mute Input", EDJE_CHANNEL_INPUT, mute_input_change);
+   MUTE_CHECK("Mute Alert", EDJE_CHANNEL_ALERT, mute_alert_change);
+   MUTE_CHECK("Mute Everything", EDJE_CHANNEL_ALL, mute_all_change);
+   
+   evas_object_data_set(win, "audio", bx);
+
+   elm_naviframe_item_simple_push(naviframe, bx);
+}
+
 static void
 _status_config_etc(Evas_Object *win,
                    Evas_Object *naviframe)
@@ -3487,6 +3551,7 @@ _status_config_full(Evas_Object *win,
    elm_toolbar_item_append(tb, "video-display", "Rendering",
                            _cf_rendering, win);
    elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win);
+   elm_toolbar_item_append(tb, "sound", "Audio", _cf_audio, win);
    elm_toolbar_item_append(tb, NULL, "Etc", _cf_etc, win);
 
    elm_box_pack_end(bx0, tb);
@@ -3503,6 +3568,7 @@ _status_config_full(Evas_Object *win,
    _status_config_rendering(win, naviframe);
    _status_config_scrolling(win, naviframe);
    _status_config_caches(win, naviframe);
+   _status_config_audio(win, naviframe);
    _status_config_etc(win, naviframe);
    _status_config_sizing(win, naviframe); // Note: call this at the end.
 
index 4635b5e..97becab 100644 (file)
@@ -61,6 +61,7 @@ static const Elm_Text_Class _elm_text_classes[] = {
 
 static void        _config_free(Elm_Config *cfg);
 static void        _config_apply(void);
+static void        _config_sub_apply(void);
 static void        _config_update(void);
 static void        _env_get(void);
 
@@ -161,6 +162,7 @@ _prop_config_get(void)
    _elm_config = config_data;
    _env_get();
    _config_apply();
+   _config_sub_apply();
    _elm_config_font_overlay_apply();
    _elm_rescale();
    _elm_recache();
@@ -418,6 +420,14 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, clouseau_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, magnifier_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, magnifier_scale, T_DOUBLE);
+   ELM_CONFIG_VAL(D, T, audio_mute_effect, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_background, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_music, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_foreground, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_interface, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_input, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_alert, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, audio_mute_all, T_UCHAR);
 #undef T
 #undef D
 #undef T_INT
@@ -995,6 +1005,14 @@ _config_sub_apply(void)
    edje_password_show_last_set(_elm_config->password_show_last);
    edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
    if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, _elm_config->audio_mute_effect);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_BACKGROUND, _elm_config->audio_mute_background);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_MUSIC, _elm_config->audio_mute_music);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_FOREGROUND, _elm_config->audio_mute_foreground);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_INTERFACE, _elm_config->audio_mute_interface);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_INPUT, _elm_config->audio_mute_input);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_ALERT, _elm_config->audio_mute_alert);
+   edje_audio_channel_mute_set(EDJE_CHANNEL_ALL, _elm_config->audio_mute_all);
 }
 
 static Eina_Bool
@@ -1200,6 +1218,14 @@ _config_load(void)
    _elm_config->disable_external_menu = EINA_FALSE;
    _elm_config->magnifier_enable = EINA_TRUE;
    _elm_config->magnifier_scale = 1.5;
+   _elm_config->audio_mute_effect = 0;
+   _elm_config->audio_mute_background = 0;
+   _elm_config->audio_mute_music = 0;
+   _elm_config->audio_mute_foreground = 0;
+   _elm_config->audio_mute_interface = 0;
+   _elm_config->audio_mute_input = 0;
+   _elm_config->audio_mute_alert = 0;
+   _elm_config->audio_mute_all = 0;
 }
 
 static const char *
@@ -2430,6 +2456,76 @@ elm_config_magnifier_scale_set(double scale)
    _elm_config->magnifier_scale = scale;
 }
 
+EAPI Eina_Bool
+elm_config_audio_mute_get(Edje_Channel channel)
+{
+   switch (channel)
+     {
+      case EDJE_CHANNEL_EFFECT:
+        return _elm_config->audio_mute_effect;
+        break;
+      case EDJE_CHANNEL_BACKGROUND:
+        return _elm_config->audio_mute_background;
+        break;
+      case EDJE_CHANNEL_MUSIC:
+        return _elm_config->audio_mute_music;
+        break;
+      case EDJE_CHANNEL_FOREGROUND:
+        return _elm_config->audio_mute_foreground;
+        break;
+      case EDJE_CHANNEL_INTERFACE:
+        return _elm_config->audio_mute_interface;
+        break;
+      case EDJE_CHANNEL_INPUT:
+        return _elm_config->audio_mute_input;
+        break;
+      case EDJE_CHANNEL_ALERT:
+        return _elm_config->audio_mute_alert;
+        break;
+      case EDJE_CHANNEL_ALL:
+        return _elm_config->audio_mute_all;
+        break;
+      default:
+        break;
+     }
+   return EINA_FALSE;
+}
+
+EAPI void
+elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute)
+{
+   switch (channel)
+     {
+      case EDJE_CHANNEL_EFFECT:
+        _elm_config->audio_mute_effect = mute;
+        break;
+      case EDJE_CHANNEL_BACKGROUND:
+        _elm_config->audio_mute_background = mute;
+        break;
+      case EDJE_CHANNEL_MUSIC:
+        _elm_config->audio_mute_music = mute;
+        break;
+      case EDJE_CHANNEL_FOREGROUND:
+        _elm_config->audio_mute_foreground = mute;
+        break;
+      case EDJE_CHANNEL_INTERFACE:
+        _elm_config->audio_mute_interface = mute;
+        break;
+      case EDJE_CHANNEL_INPUT:
+        _elm_config->audio_mute_input = mute;
+        break;
+      case EDJE_CHANNEL_ALERT:
+        _elm_config->audio_mute_alert = mute;
+        break;
+      case EDJE_CHANNEL_ALL:
+        _elm_config->audio_mute_all = mute;
+        break;
+      default:
+        break;
+     }
+   edje_audio_channel_mute_set(channel, mute);
+}
+
 EAPI void
 elm_config_all_flush(void)
 {
index 07ac78f..9fd480e 100644 (file)
@@ -1254,6 +1254,56 @@ EAPI double   elm_config_glayer_double_tap_timeout_get(void);
 EAPI void   elm_config_glayer_double_tap_timeout_set(double double_tap_timeout);
 
 /**
+ * Get the magnifier enabled state for entries
+ * 
+ * @return The enabled state for magnifier
+ * @since 1.9
+ */
+EAPI Eina_Bool elm_config_magnifier_enable_get(void);
+
+/**
+ * Set the magnifier enabled state for entires
+ * 
+ * @param enable The magnifier config state
+ * @since 1.9
+ */
+EAPI void      elm_config_magnifier_enable_set(Eina_Bool enable);
+
+/**
+ * Get the amount of scaling the magnifer does
+ * 
+ * @return The scaling amount (1.0 is none, 2.0 is twice as big etc.)
+ * @since 1.9
+ */
+EAPI double    elm_config_magnifier_scale_get(void);
+
+/**
+ * Set the amount of scaling the magnifier does
+ * 
+ * @param scale The scaling amount for magnifiers
+ * @since 1.9
+ */
+EAPI void      elm_config_magnifier_scale_set(double scale);
+
+/**
+ * Get the mute state of an audio channel for effects
+ * 
+ * @param channel The channel to get the mute state of
+ * @return The mute state
+ * @since 1.9
+ */
+EAPI Eina_Bool elm_config_audio_mute_get(Edje_Channel channel);
+
+/**
+ * Set the mute state of the specified channel
+ * 
+ * @param channel The channel to set the mute state of
+ * @param mute The mute state to set
+ * @since 1.9
+ */
+EAPI void      elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute);
+
+/**
  * @}
  */
 
index f26ba05..f7977b5 100644 (file)
@@ -266,6 +266,14 @@ struct _Elm_Config
    unsigned char clouseau_enable;
    unsigned char magnifier_enable;
    double        magnifier_scale;
+   unsigned char audio_mute_effect;
+   unsigned char audio_mute_background;
+   unsigned char audio_mute_music;
+   unsigned char audio_mute_foreground;
+   unsigned char audio_mute_interface;
+   unsigned char audio_mute_input;
+   unsigned char audio_mute_alert;
+   unsigned char audio_mute_all;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;