forked from enlightenment/enlightenment
e_mixer: volume,mute,state set/get use channel info and capabilities
SVN revision: 83920
This commit is contained in:
parent
f71970173d
commit
577019db54
|
@ -65,7 +65,7 @@ _cb_changed_left(void *data, Evas_Object *obj __UNUSED__)
|
|||
state->right);
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info->id,
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ _cb_changed_right(void *data, Evas_Object *obj __UNUSED__)
|
|||
state->left);
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info->id,
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ _cb_changed_mute(void *data, Evas_Object *obj __UNUSED__)
|
|||
{
|
||||
E_Mixer_App_Dialog_Data *app = data;
|
||||
|
||||
e_mod_mixer_mute_set(app->sys, app->channel_info->id, app->state.mute);
|
||||
e_mod_mixer_mute_set(app->sys, app->channel_info, app->state.mute);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -112,7 +112,7 @@ _cb_changed_lock_sliders(void *data, Evas_Object *obj __UNUSED__)
|
|||
|
||||
e_widget_slider_value_int_set(app->ui.channel_editor.left, state->left);
|
||||
e_widget_slider_value_int_set(app->ui.channel_editor.right, state->right);
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info->id,
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
|
|||
else
|
||||
e_widget_entry_text_set(ui->type, _("Switch"));
|
||||
|
||||
e_mod_mixer_state_get(app->sys, app->channel_info->id, &state);
|
||||
e_mod_mixer_state_get(app->sys, app->channel_info, &state);
|
||||
_update_channel_editor_state(app, state);
|
||||
|
||||
if (e_mod_mixer_channel_is_mutable(app->channel_info))
|
||||
|
@ -249,7 +249,7 @@ _cb_system_update(void *data, E_Mixer_System *sys __UNUSED__)
|
|||
if ((!app->sys) || (!app->channel_info))
|
||||
return 1;
|
||||
|
||||
e_mod_mixer_state_get(app->sys, app->channel_info->id, &state);
|
||||
e_mod_mixer_state_get(app->sys, app->channel_info, &state);
|
||||
_update_channel_editor_state(app, state);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -251,7 +251,7 @@ _mixer_balance_left(E_Mixer_Instance *inst)
|
|||
E_Mixer_Channel_State *state;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
if (state->left >= 0)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ _mixer_balance_left(E_Mixer_Instance *inst)
|
|||
state->right = 100;
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
_mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ _mixer_balance_right(E_Mixer_Instance *inst)
|
|||
E_Mixer_Channel_State *state;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
if (state->left >= 0)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ _mixer_balance_right(E_Mixer_Instance *inst)
|
|||
else
|
||||
state->right = 0;
|
||||
}
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
_mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ _mixer_volume_increase(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
E_Mixer_Channel_State *state;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
if (state->left >= 0)
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ _mixer_volume_increase(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
state->right = 100;
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
_mixer_gadget_update(inst);
|
||||
if (non_ui)
|
||||
|
@ -337,7 +337,7 @@ _mixer_volume_decrease(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
E_Mixer_Channel_State *state;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
if (state->left >= 0)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ _mixer_volume_decrease(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
state->right = 0;
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
_mixer_gadget_update(inst);
|
||||
if (non_ui)
|
||||
|
@ -370,10 +370,10 @@ _mixer_toggle_mute(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
return;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_mute_get(inst->sys, inst->channel_info->id, &state->mute);
|
||||
e_mod_mixer_mute_get(inst->sys, inst->channel_info, &state->mute);
|
||||
state->mute = !state->mute;
|
||||
e_mod_mixer_mute_set(inst->sys, inst->channel_info->id, state->mute);
|
||||
if (!state->mute) e_mod_mixer_volume_set(inst->sys, inst->channel_info->id, state->left, state->right);
|
||||
e_mod_mixer_mute_set(inst->sys, inst->channel_info, state->mute);
|
||||
if (!state->mute) e_mod_mixer_volume_set(inst->sys, inst->channel_info, state->left, state->right);
|
||||
_mixer_gadget_update(inst);
|
||||
if (non_ui)
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ _mixer_popup_cb_volume_left_change(void *data, Evas_Object *obj, void *event __U
|
|||
E_Mixer_Instance *inst = data;
|
||||
E_Mixer_Channel_State *state = &inst->mixer_state;
|
||||
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
|
||||
state->left = (int)e_slider_value_get(obj);
|
||||
|
@ -400,7 +400,7 @@ _mixer_popup_cb_volume_left_change(void *data, Evas_Object *obj, void *event __U
|
|||
e_slider_value_set(inst->ui.right, state->right);
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
if (!_mixer_using_default) _mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ _mixer_popup_cb_volume_right_change(void *data, Evas_Object *obj, void *event __
|
|||
E_Mixer_Instance *inst = data;
|
||||
E_Mixer_Channel_State *state = &inst->mixer_state;
|
||||
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_get(inst->sys, inst->channel_info,
|
||||
&state->left, &state->right);
|
||||
|
||||
state->right = (int)e_slider_value_get(obj);
|
||||
|
@ -421,7 +421,7 @@ _mixer_popup_cb_volume_right_change(void *data, Evas_Object *obj, void *event __
|
|||
e_slider_value_set(inst->ui.left, state->left);
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
state->left, state->right);
|
||||
if (!_mixer_using_default) _mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ _mixer_popup_cb_mute_change(void *data, Evas_Object *obj, void *event __UNUSED__
|
|||
E_Mixer_Channel_State *state = &inst->mixer_state;
|
||||
|
||||
state->mute = e_widget_check_checked_get(obj);
|
||||
e_mod_mixer_mute_set(inst->sys, inst->channel_info->id, state->mute);
|
||||
e_mod_mixer_mute_set(inst->sys, inst->channel_info, state->mute);
|
||||
|
||||
if (!_mixer_using_default) _mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ _mixer_popup_new(E_Mixer_Instance *inst)
|
|||
return;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, state);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info, state);
|
||||
|
||||
if (e_mod_mixer_channel_has_no_volume(inst->channel_info) ||
|
||||
e_mod_mixer_channel_is_mono(inst->channel_info) ||
|
||||
|
@ -858,7 +858,7 @@ static int
|
|||
_mixer_system_cb_update(void *data, E_Mixer_System *sys __UNUSED__)
|
||||
{
|
||||
E_Mixer_Instance *inst = data;
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, &inst->mixer_state);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info, &inst->mixer_state);
|
||||
_mixer_gadget_update(inst);
|
||||
|
||||
return 1;
|
||||
|
@ -1009,10 +1009,10 @@ e_sys_pulse_ready_cb(Eina_Bool ready)
|
|||
if (inst->channel_info)
|
||||
{
|
||||
if ((inst->mixer_state.left > -1) && (inst->mixer_state.right > -1) && (inst->mixer_state.mute > -1))
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
inst->mixer_state.left, inst->mixer_state.right);
|
||||
else
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, &inst->mixer_state);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info, &inst->mixer_state);
|
||||
}
|
||||
_mixer_gadget_update(inst);
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ e_sys_pulse_update_cb(void)
|
|||
{
|
||||
if (inst->conf->using_default)
|
||||
_mixer_sys_setup_default_card(inst);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, &inst->mixer_state);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info, &inst->mixer_state);
|
||||
_mixer_gadget_update(inst);
|
||||
}
|
||||
}
|
||||
|
@ -1104,10 +1104,10 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|||
{
|
||||
if (_mixer_using_default &&
|
||||
((inst->mixer_state.left > -1) && (inst->mixer_state.right > -1) && (inst->mixer_state.mute > -1)))
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info->id,
|
||||
e_mod_mixer_volume_set(inst->sys, inst->channel_info,
|
||||
inst->mixer_state.left, inst->mixer_state.right);
|
||||
else
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, &inst->mixer_state);
|
||||
e_mod_mixer_state_get(inst->sys, inst->channel_info, &inst->mixer_state);
|
||||
_mixer_gadget_update(inst);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,11 @@ typedef struct _E_Mixer_Channel_Info
|
|||
E_Mixer_App *app;
|
||||
} E_Mixer_Channel_Info;
|
||||
|
||||
typedef int (*E_Mixer_Volume_Set_Cb)(E_Mixer_System *, E_Mixer_Channel *, int, int);
|
||||
typedef int (*E_Mixer_Volume_Get_Cb)(E_Mixer_System *, E_Mixer_Channel *, int *, int *);
|
||||
typedef int (*E_Mixer_Mute_Get_Cb)(E_Mixer_System *, E_Mixer_Channel *, int *);
|
||||
typedef int (*E_Mixer_Mute_Set_Cb)(E_Mixer_System *, E_Mixer_Channel *, int);
|
||||
typedef int (*E_Mixer_State_Get_Cb)(E_Mixer_System *, E_Mixer_Channel *, E_Mixer_Channel_State *);
|
||||
typedef int (*E_Mixer_Capture_Cb)(E_Mixer_System *, E_Mixer_Channel *);
|
||||
typedef int (*E_Mixer_Volume_Set_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int, int);
|
||||
typedef int (*E_Mixer_Volume_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int *, int *);
|
||||
typedef int (*E_Mixer_Mute_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int *);
|
||||
typedef int (*E_Mixer_Mute_Set_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int);
|
||||
typedef int (*E_Mixer_State_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, E_Mixer_Channel_State *);
|
||||
typedef void *(*E_Mixer_Cb)();
|
||||
typedef void *(*E_Mixer_Ready_Cb)(Eina_Bool);
|
||||
|
||||
|
@ -99,12 +98,11 @@ Eina_List *e_mixer_alsa_get_channel_names(E_Mixer_System *self);
|
|||
const char *e_mixer_alsa_get_default_channel_name(E_Mixer_System *self);
|
||||
E_Mixer_Channel_Info *e_mixer_alsa_get_channel_by_name(E_Mixer_System *self, const char *name);
|
||||
|
||||
int e_mixer_alsa_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right);
|
||||
int e_mixer_alsa_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int left, int right);
|
||||
int e_mixer_alsa_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute);
|
||||
int e_mixer_alsa_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int mute);
|
||||
int e_mixer_alsa_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_Channel_State *state);
|
||||
int e_mixer_alsa_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_Mixer_Channel_State *state);
|
||||
int e_mixer_alsa_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right);
|
||||
int e_mixer_alsa_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right);
|
||||
int e_mixer_alsa_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *mute);
|
||||
int e_mixer_alsa_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int mute);
|
||||
int e_mixer_alsa_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
|
||||
|
||||
/* PULSE */
|
||||
Eina_Bool e_mixer_pulse_ready(void);
|
||||
|
@ -125,12 +123,11 @@ Eina_List *e_mixer_pulse_get_channel_names(E_Mixer_System *self);
|
|||
const char *e_mixer_pulse_get_default_channel_name(E_Mixer_System *self);
|
||||
E_Mixer_Channel_Info *e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name);
|
||||
|
||||
int e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right);
|
||||
int e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int left, int right);
|
||||
int e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute);
|
||||
int e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int mute);
|
||||
int e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_Channel_State *state);
|
||||
int e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_Mixer_Channel_State *state);
|
||||
int e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right);
|
||||
int e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right);
|
||||
int e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *mute);
|
||||
int e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int mute);
|
||||
int e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
|
||||
|
||||
/**
|
||||
* @addtogroup Optional_Devices
|
||||
|
|
|
@ -480,7 +480,7 @@ e_mixer_alsa_get_channel_name(E_Mixer_System *self,
|
|||
|
||||
int
|
||||
e_mixer_alsa_get_volume(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_Info *channel,
|
||||
int *left,
|
||||
int *right)
|
||||
{
|
||||
|
@ -490,24 +490,34 @@ e_mixer_alsa_get_volume(E_Mixer_System *self,
|
|||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||
|
||||
if (e_mod_mixer_channel_has_playback(channel))
|
||||
snd_mixer_selem_get_playback_volume_range(channel->id, &min, &max);
|
||||
else if (e_mod_mixer_channel_has_capture(channel))
|
||||
snd_mixer_selem_get_capture_volume_range(channel->id, &min, &max);
|
||||
else
|
||||
return 0;
|
||||
|
||||
range = max - min;
|
||||
if (range < 1)
|
||||
return 0;
|
||||
|
||||
if (snd_mixer_selem_has_playback_channel(channel, 0))
|
||||
snd_mixer_selem_get_playback_volume(channel, 0, &lvol);
|
||||
if (e_mod_mixer_channel_has_playback(channel))
|
||||
{
|
||||
snd_mixer_selem_get_playback_volume(channel->id, 0, &lvol);
|
||||
if (!e_mod_mixer_channel_is_mono(channel))
|
||||
snd_mixer_selem_get_playback_volume(channel->id, 1, &rvol);
|
||||
else
|
||||
rvol = lvol;
|
||||
}
|
||||
else
|
||||
lvol = min;
|
||||
|
||||
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
||||
snd_mixer_selem_get_playback_volume(channel, 1, &rvol);
|
||||
else
|
||||
rvol = min;
|
||||
|
||||
if (snd_mixer_selem_is_playback_mono(channel) ||
|
||||
snd_mixer_selem_has_playback_volume_joined(channel))
|
||||
rvol = lvol;
|
||||
{
|
||||
snd_mixer_selem_get_capture_volume(channel->id, 0, &lvol);
|
||||
if (!e_mod_mixer_channel_is_mono(channel))
|
||||
snd_mixer_selem_get_capture_volume(channel->id, 1, &rvol);
|
||||
else
|
||||
rvol = lvol;
|
||||
}
|
||||
|
||||
*left = rint((double)(lvol - min) * 100 / (double)range);
|
||||
*right = rint((double)(rvol - min) * 100 / (double)range);
|
||||
|
@ -517,7 +527,7 @@ e_mixer_alsa_get_volume(E_Mixer_System *self,
|
|||
|
||||
int
|
||||
e_mixer_alsa_set_volume(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_Info *channel,
|
||||
int left,
|
||||
int right)
|
||||
{
|
||||
|
@ -528,7 +538,14 @@ e_mixer_alsa_set_volume(E_Mixer_System *self,
|
|||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||
|
||||
if (e_mod_mixer_channel_has_playback(channel))
|
||||
snd_mixer_selem_get_playback_volume_range(channel->id, &min, &max);
|
||||
else if (e_mod_mixer_channel_has_capture(channel))
|
||||
snd_mixer_selem_get_capture_volume_range(channel->id, &min, &max);
|
||||
else
|
||||
return 0;
|
||||
|
||||
divide = 100 + min;
|
||||
if (divide == 0)
|
||||
{
|
||||
|
@ -547,21 +564,26 @@ e_mixer_alsa_set_volume(E_Mixer_System *self,
|
|||
mode |= 1;
|
||||
}
|
||||
|
||||
if (right >= 0)
|
||||
if (!e_mod_mixer_channel_is_mono(channel) && (right >= 0))
|
||||
{
|
||||
right = (((range * right) + (range / 2)) / divide) - min;
|
||||
mode |= 2;
|
||||
}
|
||||
|
||||
if (mode & 1)
|
||||
snd_mixer_selem_set_playback_volume(channel, 0, left);
|
||||
|
||||
if ((!snd_mixer_selem_is_playback_mono(channel)) &&
|
||||
(!snd_mixer_selem_has_playback_volume_joined(channel)) &&
|
||||
(mode & 2))
|
||||
{
|
||||
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
||||
snd_mixer_selem_set_playback_volume(channel, 1, right);
|
||||
if (e_mod_mixer_channel_has_playback(channel))
|
||||
snd_mixer_selem_set_playback_volume(channel->id, 0, left);
|
||||
else
|
||||
snd_mixer_selem_set_capture_volume(channel->id, 0, left);
|
||||
}
|
||||
|
||||
if (mode & 2)
|
||||
{
|
||||
if (e_mod_mixer_channel_has_playback(channel))
|
||||
snd_mixer_selem_set_playback_volume(channel->id, 1, right);
|
||||
else
|
||||
snd_mixer_selem_set_capture_volume(channel->id, 1, right);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -569,22 +591,25 @@ e_mixer_alsa_set_volume(E_Mixer_System *self,
|
|||
|
||||
int
|
||||
e_mixer_alsa_get_mute(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_Info *channel,
|
||||
int *mute)
|
||||
{
|
||||
if ((!self) || (!channel) || (!mute))
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
if (snd_mixer_selem_has_playback_switch(channel) ||
|
||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||
|
||||
if (e_mod_mixer_channel_is_mutable(channel))
|
||||
{
|
||||
int m;
|
||||
|
||||
/* XXX: not checking for return, always returns 0 even if it worked.
|
||||
* alsamixer also don't check it. Bug?
|
||||
*/
|
||||
snd_mixer_selem_get_playback_switch(channel, 0, &m);
|
||||
if (e_mod_mixer_channel_has_capture(channel))
|
||||
snd_mixer_selem_get_capture_switch(channel->id, 0, &m);
|
||||
else
|
||||
snd_mixer_selem_get_playback_switch(channel->id, 0, &m);
|
||||
*mute = !m;
|
||||
}
|
||||
else
|
||||
|
@ -595,23 +620,26 @@ e_mixer_alsa_get_mute(E_Mixer_System *self,
|
|||
|
||||
int
|
||||
e_mixer_alsa_set_mute(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_Info *channel,
|
||||
int mute)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
if (snd_mixer_selem_has_playback_switch(channel) ||
|
||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||
return snd_mixer_selem_set_playback_switch_all(channel, !mute);
|
||||
if (e_mod_mixer_channel_is_mutable(channel))
|
||||
{
|
||||
if (e_mod_mixer_channel_has_capture(channel))
|
||||
return snd_mixer_selem_set_capture_switch_all(channel->id, !mute);
|
||||
else
|
||||
return snd_mixer_selem_set_playback_switch_all(channel->id, !mute);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_alsa_get_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_Info *channel,
|
||||
E_Mixer_Channel_State *state)
|
||||
{
|
||||
int r;
|
||||
|
@ -624,18 +652,18 @@ e_mixer_alsa_get_state(E_Mixer_System *self,
|
|||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_alsa_set_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
const E_Mixer_Channel_State *state)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (!state)
|
||||
return 0;
|
||||
|
||||
r = e_mixer_alsa_set_mute(self, channel, state->mute);
|
||||
r &= e_mixer_alsa_set_volume(self, channel, state->left, state->right);
|
||||
return r;
|
||||
}
|
||||
/* int */
|
||||
/* e_mixer_alsa_set_state(E_Mixer_System *self, */
|
||||
/* E_Mixer_Channel *channel, */
|
||||
/* const E_Mixer_Channel_State *state) */
|
||||
/* { */
|
||||
/* int r; */
|
||||
/**/
|
||||
/* if (!state) */
|
||||
/* return 0; */
|
||||
/**/
|
||||
/* r = e_mixer_alsa_set_mute(self, channel, state->mute); */
|
||||
/* r &= e_mixer_alsa_set_volume(self, channel, state->left, state->right); */
|
||||
/* return r; */
|
||||
/* } */
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ e_mixer_system_get_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *chann
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_system_set_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__, const E_Mixer_Channel_State *state __UNUSED__)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* int */
|
||||
/* e_mixer_system_set_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__, const E_Mixer_Channel_State *state __UNUSED__) */
|
||||
/* { */
|
||||
/* return 0; */
|
||||
/* } */
|
||||
|
||||
|
|
|
@ -310,9 +310,9 @@ _pulse_queue_process(const Eina_Hash *h EINA_UNUSED, const char *key, E_Mixer_Ch
|
|||
{
|
||||
if (key != pulse_sink_name_get(s)) continue;
|
||||
if ((state->left >= 0) || (state->right >= 0))
|
||||
e_mixer_pulse_set_volume(s, &ch, state->left, state->right);
|
||||
e_mixer_pulse_set_volume(s, (E_Mixer_Channel_Info*)&ch, state->left, state->right);
|
||||
if (state->mute >= 0)
|
||||
e_mixer_pulse_set_mute(s, &ch, state->mute);
|
||||
e_mixer_pulse_set_mute(s, (E_Mixer_Channel_Info*)&ch, state->mute);
|
||||
state->left = state->right = state->mute = -1;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ e_mixer_pulse_get_channel_name(E_Mixer_System *self EINA_UNUSED, E_Mixer_Channel
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right)
|
||||
e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right)
|
||||
{
|
||||
double volume;
|
||||
int x, n;
|
||||
|
@ -549,7 +549,7 @@ e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *le
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int left, int right)
|
||||
e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right)
|
||||
{
|
||||
uint32_t id = 0;
|
||||
int x, n;
|
||||
|
@ -586,14 +586,14 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__, int *mute)
|
||||
e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel __UNUSED__, int *mute)
|
||||
{
|
||||
if (mute) *mute = pulse_sink_muted_get((void *)self);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__, int mute)
|
||||
e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel __UNUSED__, int mute)
|
||||
{
|
||||
uint32_t id;
|
||||
Eina_Bool source = EINA_FALSE;
|
||||
|
@ -612,7 +612,7 @@ e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_Channel_State *state)
|
||||
e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state)
|
||||
{
|
||||
if (!state) return 0;
|
||||
if (!channel) return 0;
|
||||
|
@ -621,11 +621,11 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_Mixer_Channel_State *state)
|
||||
{
|
||||
e_mixer_pulse_set_volume(self, channel, state->left, state->right);
|
||||
e_mixer_pulse_set_mute(self, channel, state->mute);
|
||||
return 1;
|
||||
}
|
||||
/* int */
|
||||
/* e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state) */
|
||||
/* { */
|
||||
/* e_mixer_pulse_set_volume(self, channel, state->left, state->right); */
|
||||
/* e_mixer_pulse_set_mute(self, channel, state->mute); */
|
||||
/* return 1; */
|
||||
/* } */
|
||||
|
||||
|
|
Loading…
Reference in New Issue