From 2914212ff2dc18d98746d4b78fdffba4ab2ae912 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 31 Oct 2012 11:23:26 +0000 Subject: [PATCH] pulse mixer no longer runs its init function constantly and should allow the slider to become much more responsive/accurate. also implement volume saving per gadget ticket #1697 SVN revision: 78702 --- src/modules/mixer/e_mod_main.c | 27 +++++++++++++++++++++++---- src/modules/mixer/e_mod_main.h | 3 ++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index e1b86eca2..2352f19df 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -242,8 +242,6 @@ _mixer_gadget_update(E_Mixer_Instance *inst) if (!inst) return; - e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state); - msg = alloca(sizeof(Edje_Message_Int_Set) + (2 * sizeof(int))); msg->count = 3; msg->val[0] = inst->mixer_state.mute; @@ -955,9 +953,12 @@ e_mod_mixer_pulse_ready(Eina_Bool ready) E_Mixer_Module_Context *ctxt; Eina_List *l; Eina_Bool pulse = _mixer_using_default; + static Eina_Bool called = EINA_FALSE; if (!mixer_mod) return; + if (called && (ready != _mixer_using_default)) return; // prevent multiple calls + if (ready) e_mixer_pulse_setup(); else e_mixer_default_setup(); @@ -975,9 +976,14 @@ e_mod_mixer_pulse_ready(Eina_Bool ready) inst->sys = NULL; return; } - e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state); + if ((ctxt->conf->version & 0xffff) >= 0x0004) + e_mod_mixer_volume_set(inst->sys, inst->channel, + inst->mixer_state.left, inst->mixer_state.right); + else + e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state); _mixer_gadget_update(inst); } + called = EINA_TRUE; } void @@ -1031,6 +1037,9 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst = E_NEW(E_Mixer_Instance, 1); inst->conf = conf; + inst->mixer_state.right = inst->conf->state.right; + inst->mixer_state.left = inst->conf->state.left; + inst->mixer_state.mute = inst->conf->state.mute; conf->instance = inst; if ((!_mixer_sys_setup(inst)) && (!_mixer_sys_setup_defaults(inst))) { @@ -1057,7 +1066,11 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) if (inst->sys) { - e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state); + if (_mixer_using_default && ((ctxt->conf->version & 0xffff) >= 0x0004)) + e_mod_mixer_volume_set(inst->sys, inst->channel, + inst->mixer_state.left, inst->mixer_state.right); + else + e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state); _mixer_gadget_update(inst); } @@ -1092,6 +1105,9 @@ _gc_shutdown(E_Gadcon_Client *gcc) if (!inst) return; + inst->conf->state.mute = inst->mixer_state.mute; + inst->conf->state.left = inst->mixer_state.left; + inst->conf->state.right = inst->mixer_state.right; evas_object_del(inst->ui.gadget); e_mod_mixer_channel_del(inst->channel); e_mod_mixer_del(inst->sys); @@ -1303,6 +1319,9 @@ _mixer_gadget_configuration_descriptor_new(void) E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, card, STR); E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, channel_name, STR); E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, using_default, UCHAR); + E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, state.mute, INT); + E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, state.left, INT); + E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, state.right, INT); return conf_edd; } diff --git a/src/modules/mixer/e_mod_main.h b/src/modules/mixer/e_mod_main.h index ea109ea9b..09120b782 100644 --- a/src/modules/mixer/e_mod_main.h +++ b/src/modules/mixer/e_mod_main.h @@ -6,7 +6,7 @@ #include #define MOD_CONFIG_FILE_EPOCH 0x0000 -#define MOD_CONFIG_FILE_GENERATION 0x0003 +#define MOD_CONFIG_FILE_GENERATION 0x0004 #define MOD_CONFIG_FILE_VERSION \ ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) @@ -18,6 +18,7 @@ typedef struct E_Mixer_Gadget_Config const char *card; const char *channel_name; const char *id; + E_Mixer_Channel_State state; Eina_Bool using_default; E_Config_Dialog *dialog; struct E_Mixer_Instance *instance;