summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-02-09 19:12:12 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-02-09 19:17:01 +0900
commit5680efe581fb243699948fbb6cd3bff96cf68854 (patch)
tree5404685e82c2e1c9838cd0dc88eeda732140ebfc
parentf086ac9a971198d9991edee43d3c5db50a0db9da (diff)
config - feature add - audio muting config and controls
-rw-r--r--config/default/base.src8
-rw-r--r--config/mobile/base.src8
-rw-r--r--config/standard/base.src8
-rw-r--r--src/bin/config.c66
-rw-r--r--src/lib/elm_config.c96
-rw-r--r--src/lib/elm_config.h50
-rw-r--r--src/lib/elm_priv.h8
7 files changed, 244 insertions, 0 deletions
diff --git a/config/default/base.src b/config/default/base.src
index db8595649..124f5bf60 100644
--- a/config/default/base.src
+++ b/config/default/base.src
@@ -80,6 +80,14 @@ group "Elm_Config" struct {
80 value "auto_throttle_amount" double: 0.1; 80 value "auto_throttle_amount" double: 0.1;
81 value "magnifier_enable" uchar: 1; 81 value "magnifier_enable" uchar: 1;
82 value "magnifier_scale" double: 1.5; 82 value "magnifier_scale" double: 1.5;
83 value "audio_mute_effect" uchar: 0;
84 value "audio_mute_background" uchar: 0;
85 value "audio_mute_music" uchar: 0;
86 value "audio_mute_foreground" uchar: 0;
87 value "audio_mute_interface" uchar: 0;
88 value "audio_mute_input" uchar: 0;
89 value "audio_mute_alert" uchar: 0;
90 value "audio_mute_all" uchar: 0;
83 group "color_palette" list { 91 group "color_palette" list {
84 group "Elm_Custom_Palette" struct { 92 group "Elm_Custom_Palette" struct {
85 value "palette_name" string: "default"; 93 value "palette_name" string: "default";
diff --git a/config/mobile/base.src b/config/mobile/base.src
index afc58e186..f634b1de8 100644
--- a/config/mobile/base.src
+++ b/config/mobile/base.src
@@ -84,6 +84,14 @@ group "Elm_Config" struct {
84 value "indicator_service_270" string: "elm_indicator_landscape"; 84 value "indicator_service_270" string: "elm_indicator_landscape";
85 value "magnifier_enable" uchar: 1; 85 value "magnifier_enable" uchar: 1;
86 value "magnifier_scale" double: 1.5; 86 value "magnifier_scale" double: 1.5;
87 value "audio_mute_effect" uchar: 0;
88 value "audio_mute_background" uchar: 0;
89 value "audio_mute_music" uchar: 0;
90 value "audio_mute_foreground" uchar: 0;
91 value "audio_mute_interface" uchar: 0;
92 value "audio_mute_input" uchar: 0;
93 value "audio_mute_alert" uchar: 0;
94 value "audio_mute_all" uchar: 0;
87 group "color_palette" list { 95 group "color_palette" list {
88 group "Elm_Custom_Palette" struct { 96 group "Elm_Custom_Palette" struct {
89 value "palette_name" string: "default"; 97 value "palette_name" string: "default";
diff --git a/config/standard/base.src b/config/standard/base.src
index 8bd58ae3d..cf61b7929 100644
--- a/config/standard/base.src
+++ b/config/standard/base.src
@@ -81,6 +81,14 @@ group "Elm_Config" struct {
81 value "auto_throttle_amount" double: 0.0333333333; 81 value "auto_throttle_amount" double: 0.0333333333;
82 value "magnifier_enable" uchar: 0; 82 value "magnifier_enable" uchar: 0;
83 value "magnifier_scale" double: 1.5; 83 value "magnifier_scale" double: 1.5;
84 value "audio_mute_effect" uchar: 0;
85 value "audio_mute_background" uchar: 0;
86 value "audio_mute_music" uchar: 0;
87 value "audio_mute_foreground" uchar: 0;
88 value "audio_mute_interface" uchar: 0;
89 value "audio_mute_input" uchar: 0;
90 value "audio_mute_alert" uchar: 0;
91 value "audio_mute_all" uchar: 0;
84 group "color_palette" list { 92 group "color_palette" list {
85 group "Elm_Custom_Palette" struct { 93 group "Elm_Custom_Palette" struct {
86 value "palette_name" string: "default"; 94 value "palette_name" string: "default";
diff --git a/src/bin/config.c b/src/bin/config.c
index db94b68aa..70b8ecc69 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -951,6 +951,14 @@ _cf_caches(void *data,
951} 951}
952 952
953static void 953static void
954_cf_audio(void *data,
955 Evas_Object *obj EINA_UNUSED,
956 void *event_info EINA_UNUSED)
957{
958 _flip_to(data,"audio");
959}
960
961static void
954_cf_etc(void *data, 962_cf_etc(void *data,
955 Evas_Object *obj EINA_UNUSED, 963 Evas_Object *obj EINA_UNUSED,
956 void *event_info EINA_UNUSED) 964 void *event_info EINA_UNUSED)
@@ -1463,6 +1471,62 @@ _status_config_sizing(Evas_Object *win,
1463 elm_naviframe_item_simple_push(naviframe, bx); 1471 elm_naviframe_item_simple_push(naviframe, bx);
1464} 1472}
1465 1473
1474#define MUTE_CB(_cb, _chan) \
1475static void \
1476_cb(void *data EINA_UNUSED, \
1477 Evas_Object *obj, \
1478 void *event_info EINA_UNUSED) \
1479{ \
1480 Eina_Bool val = elm_check_state_get(obj); \
1481 Eina_Bool v = elm_config_audio_mute_get(_chan); \
1482 if (val == v) return; \
1483 elm_config_audio_mute_set(_chan, val); \
1484 elm_config_all_flush(); \
1485}
1486
1487MUTE_CB(mute_effect_change, EDJE_CHANNEL_EFFECT)
1488MUTE_CB(mute_background_change, EDJE_CHANNEL_BACKGROUND)
1489MUTE_CB(mute_music_change, EDJE_CHANNEL_MUSIC)
1490MUTE_CB(mute_foreground_change, EDJE_CHANNEL_FOREGROUND)
1491MUTE_CB(mute_interface_change, EDJE_CHANNEL_INTERFACE)
1492MUTE_CB(mute_input_change, EDJE_CHANNEL_INPUT)
1493MUTE_CB(mute_alert_change, EDJE_CHANNEL_ALERT)
1494MUTE_CB(mute_all_change, EDJE_CHANNEL_ALL)
1495
1496static void
1497_status_config_audio(Evas_Object *win,
1498 Evas_Object *naviframe)
1499{
1500 Evas_Object *bx, *ck;
1501
1502 bx = elm_box_add(win);
1503 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
1504 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
1505
1506#define MUTE_CHECK(_label, _chan, _cb) \
1507 ck = elm_check_add(win); \
1508 elm_object_text_set(ck, _label); \
1509 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); \
1510 evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); \
1511 elm_check_state_set(ck, elm_config_audio_mute_get(_chan)); \
1512 elm_box_pack_end(bx, ck); \
1513 evas_object_show(ck); \
1514 evas_object_smart_callback_add(ck, "changed", _cb, NULL);
1515
1516 MUTE_CHECK("Mute Effects", EDJE_CHANNEL_EFFECT, mute_effect_change);
1517 MUTE_CHECK("Mute Background", EDJE_CHANNEL_BACKGROUND, mute_background_change);
1518 MUTE_CHECK("Mute Music", EDJE_CHANNEL_MUSIC, mute_music_change);
1519 MUTE_CHECK("Mute Foreground", EDJE_CHANNEL_FOREGROUND, mute_foreground_change);
1520 MUTE_CHECK("Mute Interface", EDJE_CHANNEL_INTERFACE, mute_interface_change);
1521 MUTE_CHECK("Mute Input", EDJE_CHANNEL_INPUT, mute_input_change);
1522 MUTE_CHECK("Mute Alert", EDJE_CHANNEL_ALERT, mute_alert_change);
1523 MUTE_CHECK("Mute Everything", EDJE_CHANNEL_ALL, mute_all_change);
1524
1525 evas_object_data_set(win, "audio", bx);
1526
1527 elm_naviframe_item_simple_push(naviframe, bx);
1528}
1529
1466static void 1530static void
1467_status_config_etc(Evas_Object *win, 1531_status_config_etc(Evas_Object *win,
1468 Evas_Object *naviframe) 1532 Evas_Object *naviframe)
@@ -3487,6 +3551,7 @@ _status_config_full(Evas_Object *win,
3487 elm_toolbar_item_append(tb, "video-display", "Rendering", 3551 elm_toolbar_item_append(tb, "video-display", "Rendering",
3488 _cf_rendering, win); 3552 _cf_rendering, win);
3489 elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win); 3553 elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win);
3554 elm_toolbar_item_append(tb, "sound", "Audio", _cf_audio, win);
3490 elm_toolbar_item_append(tb, NULL, "Etc", _cf_etc, win); 3555 elm_toolbar_item_append(tb, NULL, "Etc", _cf_etc, win);
3491 3556
3492 elm_box_pack_end(bx0, tb); 3557 elm_box_pack_end(bx0, tb);
@@ -3503,6 +3568,7 @@ _status_config_full(Evas_Object *win,
3503 _status_config_rendering(win, naviframe); 3568 _status_config_rendering(win, naviframe);
3504 _status_config_scrolling(win, naviframe); 3569 _status_config_scrolling(win, naviframe);
3505 _status_config_caches(win, naviframe); 3570 _status_config_caches(win, naviframe);
3571 _status_config_audio(win, naviframe);
3506 _status_config_etc(win, naviframe); 3572 _status_config_etc(win, naviframe);
3507 _status_config_sizing(win, naviframe); // Note: call this at the end. 3573 _status_config_sizing(win, naviframe); // Note: call this at the end.
3508 3574
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 4635b5e48..97becab73 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -61,6 +61,7 @@ static const Elm_Text_Class _elm_text_classes[] = {
61 61
62static void _config_free(Elm_Config *cfg); 62static void _config_free(Elm_Config *cfg);
63static void _config_apply(void); 63static void _config_apply(void);
64static void _config_sub_apply(void);
64static void _config_update(void); 65static void _config_update(void);
65static void _env_get(void); 66static void _env_get(void);
66 67
@@ -161,6 +162,7 @@ _prop_config_get(void)
161 _elm_config = config_data; 162 _elm_config = config_data;
162 _env_get(); 163 _env_get();
163 _config_apply(); 164 _config_apply();
165 _config_sub_apply();
164 _elm_config_font_overlay_apply(); 166 _elm_config_font_overlay_apply();
165 _elm_rescale(); 167 _elm_rescale();
166 _elm_recache(); 168 _elm_recache();
@@ -418,6 +420,14 @@ _desc_init(void)
418 ELM_CONFIG_VAL(D, T, clouseau_enable, T_UCHAR); 420 ELM_CONFIG_VAL(D, T, clouseau_enable, T_UCHAR);
419 ELM_CONFIG_VAL(D, T, magnifier_enable, T_UCHAR); 421 ELM_CONFIG_VAL(D, T, magnifier_enable, T_UCHAR);
420 ELM_CONFIG_VAL(D, T, magnifier_scale, T_DOUBLE); 422 ELM_CONFIG_VAL(D, T, magnifier_scale, T_DOUBLE);
423 ELM_CONFIG_VAL(D, T, audio_mute_effect, T_UCHAR);
424 ELM_CONFIG_VAL(D, T, audio_mute_background, T_UCHAR);
425 ELM_CONFIG_VAL(D, T, audio_mute_music, T_UCHAR);
426 ELM_CONFIG_VAL(D, T, audio_mute_foreground, T_UCHAR);
427 ELM_CONFIG_VAL(D, T, audio_mute_interface, T_UCHAR);
428 ELM_CONFIG_VAL(D, T, audio_mute_input, T_UCHAR);
429 ELM_CONFIG_VAL(D, T, audio_mute_alert, T_UCHAR);
430 ELM_CONFIG_VAL(D, T, audio_mute_all, T_UCHAR);
421#undef T 431#undef T
422#undef D 432#undef D
423#undef T_INT 433#undef T_INT
@@ -995,6 +1005,14 @@ _config_sub_apply(void)
995 edje_password_show_last_set(_elm_config->password_show_last); 1005 edje_password_show_last_set(_elm_config->password_show_last);
996 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout); 1006 edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
997 if (_elm_config->modules) _elm_module_parse(_elm_config->modules); 1007 if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
1008 edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, _elm_config->audio_mute_effect);
1009 edje_audio_channel_mute_set(EDJE_CHANNEL_BACKGROUND, _elm_config->audio_mute_background);
1010 edje_audio_channel_mute_set(EDJE_CHANNEL_MUSIC, _elm_config->audio_mute_music);
1011 edje_audio_channel_mute_set(EDJE_CHANNEL_FOREGROUND, _elm_config->audio_mute_foreground);
1012 edje_audio_channel_mute_set(EDJE_CHANNEL_INTERFACE, _elm_config->audio_mute_interface);
1013 edje_audio_channel_mute_set(EDJE_CHANNEL_INPUT, _elm_config->audio_mute_input);
1014 edje_audio_channel_mute_set(EDJE_CHANNEL_ALERT, _elm_config->audio_mute_alert);
1015 edje_audio_channel_mute_set(EDJE_CHANNEL_ALL, _elm_config->audio_mute_all);
998} 1016}
999 1017
1000static Eina_Bool 1018static Eina_Bool
@@ -1200,6 +1218,14 @@ _config_load(void)
1200 _elm_config->disable_external_menu = EINA_FALSE; 1218 _elm_config->disable_external_menu = EINA_FALSE;
1201 _elm_config->magnifier_enable = EINA_TRUE; 1219 _elm_config->magnifier_enable = EINA_TRUE;
1202 _elm_config->magnifier_scale = 1.5; 1220 _elm_config->magnifier_scale = 1.5;
1221 _elm_config->audio_mute_effect = 0;
1222 _elm_config->audio_mute_background = 0;
1223 _elm_config->audio_mute_music = 0;
1224 _elm_config->audio_mute_foreground = 0;
1225 _elm_config->audio_mute_interface = 0;
1226 _elm_config->audio_mute_input = 0;
1227 _elm_config->audio_mute_alert = 0;
1228 _elm_config->audio_mute_all = 0;
1203} 1229}
1204 1230
1205static const char * 1231static const char *
@@ -2430,6 +2456,76 @@ elm_config_magnifier_scale_set(double scale)
2430 _elm_config->magnifier_scale = scale; 2456 _elm_config->magnifier_scale = scale;
2431} 2457}
2432 2458
2459EAPI Eina_Bool
2460elm_config_audio_mute_get(Edje_Channel channel)
2461{
2462 switch (channel)
2463 {
2464 case EDJE_CHANNEL_EFFECT:
2465 return _elm_config->audio_mute_effect;
2466 break;
2467 case EDJE_CHANNEL_BACKGROUND:
2468 return _elm_config->audio_mute_background;
2469 break;
2470 case EDJE_CHANNEL_MUSIC:
2471 return _elm_config->audio_mute_music;
2472 break;
2473 case EDJE_CHANNEL_FOREGROUND:
2474 return _elm_config->audio_mute_foreground;
2475 break;
2476 case EDJE_CHANNEL_INTERFACE:
2477 return _elm_config->audio_mute_interface;
2478 break;
2479 case EDJE_CHANNEL_INPUT:
2480 return _elm_config->audio_mute_input;
2481 break;
2482 case EDJE_CHANNEL_ALERT:
2483 return _elm_config->audio_mute_alert;
2484 break;
2485 case EDJE_CHANNEL_ALL:
2486 return _elm_config->audio_mute_all;
2487 break;
2488 default:
2489 break;
2490 }
2491 return EINA_FALSE;
2492}
2493
2494EAPI void
2495elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute)
2496{
2497 switch (channel)
2498 {
2499 case EDJE_CHANNEL_EFFECT:
2500 _elm_config->audio_mute_effect = mute;
2501 break;
2502 case EDJE_CHANNEL_BACKGROUND:
2503 _elm_config->audio_mute_background = mute;
2504 break;
2505 case EDJE_CHANNEL_MUSIC:
2506 _elm_config->audio_mute_music = mute;
2507 break;
2508 case EDJE_CHANNEL_FOREGROUND:
2509 _elm_config->audio_mute_foreground = mute;
2510 break;
2511 case EDJE_CHANNEL_INTERFACE:
2512 _elm_config->audio_mute_interface = mute;
2513 break;
2514 case EDJE_CHANNEL_INPUT:
2515 _elm_config->audio_mute_input = mute;
2516 break;
2517 case EDJE_CHANNEL_ALERT:
2518 _elm_config->audio_mute_alert = mute;
2519 break;
2520 case EDJE_CHANNEL_ALL:
2521 _elm_config->audio_mute_all = mute;
2522 break;
2523 default:
2524 break;
2525 }
2526 edje_audio_channel_mute_set(channel, mute);
2527}
2528
2433EAPI void 2529EAPI void
2434elm_config_all_flush(void) 2530elm_config_all_flush(void)
2435{ 2531{
diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
index 07ac78f1e..9fd480eb0 100644
--- a/src/lib/elm_config.h
+++ b/src/lib/elm_config.h
@@ -1254,6 +1254,56 @@ EAPI double elm_config_glayer_double_tap_timeout_get(void);
1254EAPI void elm_config_glayer_double_tap_timeout_set(double double_tap_timeout); 1254EAPI void elm_config_glayer_double_tap_timeout_set(double double_tap_timeout);
1255 1255
1256/** 1256/**
1257 * Get the magnifier enabled state for entries
1258 *
1259 * @return The enabled state for magnifier
1260 * @since 1.9
1261 */
1262EAPI Eina_Bool elm_config_magnifier_enable_get(void);
1263
1264/**
1265 * Set the magnifier enabled state for entires
1266 *
1267 * @param enable The magnifier config state
1268 * @since 1.9
1269 */
1270EAPI void elm_config_magnifier_enable_set(Eina_Bool enable);
1271
1272/**
1273 * Get the amount of scaling the magnifer does
1274 *
1275 * @return The scaling amount (1.0 is none, 2.0 is twice as big etc.)
1276 * @since 1.9
1277 */
1278EAPI double elm_config_magnifier_scale_get(void);
1279
1280/**
1281 * Set the amount of scaling the magnifier does
1282 *
1283 * @param scale The scaling amount for magnifiers
1284 * @since 1.9
1285 */
1286EAPI void elm_config_magnifier_scale_set(double scale);
1287
1288/**
1289 * Get the mute state of an audio channel for effects
1290 *
1291 * @param channel The channel to get the mute state of
1292 * @return The mute state
1293 * @since 1.9
1294 */
1295EAPI Eina_Bool elm_config_audio_mute_get(Edje_Channel channel);
1296
1297/**
1298 * Set the mute state of the specified channel
1299 *
1300 * @param channel The channel to set the mute state of
1301 * @param mute The mute state to set
1302 * @since 1.9
1303 */
1304EAPI void elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute);
1305
1306/**
1257 * @} 1307 * @}
1258 */ 1308 */
1259 1309
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index f26ba0507..f7977b506 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -266,6 +266,14 @@ struct _Elm_Config
266 unsigned char clouseau_enable; 266 unsigned char clouseau_enable;
267 unsigned char magnifier_enable; 267 unsigned char magnifier_enable;
268 double magnifier_scale; 268 double magnifier_scale;
269 unsigned char audio_mute_effect;
270 unsigned char audio_mute_background;
271 unsigned char audio_mute_music;
272 unsigned char audio_mute_foreground;
273 unsigned char audio_mute_interface;
274 unsigned char audio_mute_input;
275 unsigned char audio_mute_alert;
276 unsigned char audio_mute_all;
269 277
270 /* Not part of the EET file */ 278 /* Not part of the EET file */
271 Eina_Bool is_mirrored : 1; 279 Eina_Bool is_mirrored : 1;