forked from enlightenment/enlightenment
e_mixer: use macro for capabilities queries
SVN revision: 83917
This commit is contained in:
parent
856cbf6aea
commit
0c42626d89
|
@ -159,7 +159,7 @@ _update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel
|
|||
e_widget_disabled_set(ui->right, disabled);
|
||||
e_widget_disabled_set(ui->lock_sliders, disabled);
|
||||
|
||||
if (e_mod_mixer_channel_mutable(app->channel_info))
|
||||
if (e_mod_mixer_channel_is_mutable(app->channel_info))
|
||||
{
|
||||
e_widget_disabled_set(ui->mute, 0);
|
||||
e_widget_check_checked_set(ui->mute, state.mute);
|
||||
|
@ -265,7 +265,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
{
|
||||
E_Mixer_Channel_Info *info = l->data;
|
||||
|
||||
if (header_input != (info->capabilities & E_MIXER_CHANNEL_MASK))
|
||||
if (header_input != e_mod_mixer_channel_group_get(info))
|
||||
{
|
||||
if (e_mod_mixer_channel_is_boost(info))
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Boost"));
|
||||
|
@ -275,7 +275,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
e_widget_ilist_header_append(ilist, NULL, _("Capture"));
|
||||
else
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Switch"));
|
||||
header_input = (info->capabilities & E_MIXER_CHANNEL_MASK);
|
||||
header_input = e_mod_mixer_channel_group_get(info);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -539,9 +539,9 @@ _find_channel_by_name(E_Mixer_App_Dialog_Data *app, const char *channel_name)
|
|||
header_input = 0;
|
||||
EINA_LIST_FOREACH(app->channel_infos, l, info)
|
||||
{
|
||||
if (header_input != (info->capabilities & E_MIXER_CHANNEL_MASK))
|
||||
if (header_input != e_mod_mixer_channel_group_get(info))
|
||||
{
|
||||
header_input = (info->capabilities & E_MIXER_CHANNEL_MASK);
|
||||
header_input = e_mod_mixer_channel_group_get(info);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ _mixer_toggle_mute(E_Mixer_Instance *inst, Eina_Bool non_ui)
|
|||
{
|
||||
E_Mixer_Channel_State *state;
|
||||
|
||||
if (!e_mod_mixer_channel_mutable(inst->channel_info))
|
||||
if (!e_mod_mixer_channel_is_mutable(inst->channel_info))
|
||||
return;
|
||||
|
||||
state = &inst->mixer_state;
|
||||
|
@ -691,7 +691,7 @@ _mixer_popup_new(E_Mixer_Instance *inst)
|
|||
inst->ui.right = NULL;
|
||||
}
|
||||
|
||||
if (e_mod_mixer_channel_mutable(inst->channel_info))
|
||||
if (e_mod_mixer_channel_is_mutable(inst->channel_info))
|
||||
{
|
||||
inst->ui.mute = e_widget_check_add(evas, _("Mute"), &state->mute);
|
||||
evas_object_show(inst->ui.mute);
|
||||
|
|
|
@ -59,50 +59,18 @@ e_mixer_pulse_setup()
|
|||
_mixer_using_default = EINA_FALSE;
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_mutable(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_CAN_MUTE )!=0);
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_is_mono(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_IS_MONO )!=0);
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_has_capture(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )!=0);
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_has_playback(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )!=0);
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_is_boost(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )!=0 &&
|
||||
(channel->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )!=0);
|
||||
}
|
||||
|
||||
int e_mod_mixer_channel_has_no_volume(const E_Mixer_Channel_Info *channel)
|
||||
{
|
||||
return ((channel->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )==0 &&
|
||||
(channel->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )==0);
|
||||
}
|
||||
|
||||
static int
|
||||
_channel_info_cmp(const void *data_a, const void *data_b)
|
||||
{
|
||||
const E_Mixer_Channel_Info *a = data_a, *b = data_b;
|
||||
|
||||
if ((a->capabilities & E_MIXER_CHANNEL_MASK) == (b->capabilities & E_MIXER_CHANNEL_MASK))
|
||||
if (e_mod_mixer_channel_group_get(a) == e_mod_mixer_channel_group_get(b))
|
||||
return strcmp(a->name, b->name);
|
||||
if (e_mod_mixer_channel_is_boost(a))
|
||||
return 1;
|
||||
if (e_mod_mixer_channel_is_boost(b))
|
||||
return -1;
|
||||
if ((a->capabilities & E_MIXER_CHANNEL_MASK) < (b->capabilities & E_MIXER_CHANNEL_MASK))
|
||||
if (e_mod_mixer_channel_group_get(a) < e_mod_mixer_channel_group_get(b))
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,27 @@ typedef struct _E_Mixer_Channel_State
|
|||
#define E_MIXER_CHANNEL_IS_MONO 0x02
|
||||
#define E_MIXER_CHANNEL_HAS_CAPTURE 0x04
|
||||
#define E_MIXER_CHANNEL_HAS_PLAYBACK 0x08
|
||||
#define E_MIXER_CHANNEL_MASK 0xFC
|
||||
#define E_MIXER_CHANNEL_GROUP_MASK 0xFC
|
||||
#define E_MIXER_CHANNEL_USABLE_MASK 0xFD
|
||||
|
||||
#define e_mod_mixer_channel_is_mutable(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_CAN_MUTE )!=0 )
|
||||
#define e_mod_mixer_channel_is_mono(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_IS_MONO )!=0 )
|
||||
#define e_mod_mixer_channel_has_capture(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )!=0 )
|
||||
#define e_mod_mixer_channel_has_playback(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )!=0 )
|
||||
#define e_mod_mixer_channel_is_boost(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )!=0 && \
|
||||
((_ch)->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )!=0 )
|
||||
#define e_mod_mixer_channel_has_no_volume(_ch) \
|
||||
( ((_ch)->capabilities & E_MIXER_CHANNEL_HAS_PLAYBACK )==0 && \
|
||||
((_ch)->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )==0 )
|
||||
#define e_mod_mixer_channel_group_get(_ch) \
|
||||
( (_ch)->capabilities & E_MIXER_CHANNEL_GROUP_MASK )
|
||||
#define e_mod_mixer_capabilities_usable(_capa) \
|
||||
( ((_capa) & E_MIXER_CHANNEL_USABLE_MASK)!=0 )
|
||||
|
||||
typedef struct _E_Mixer_Channel_Info
|
||||
{
|
||||
|
@ -59,13 +79,6 @@ void e_mod_mixer_channel_infos_free(Eina_List*);
|
|||
void e_mod_mixer_channel_names_free(Eina_List*);
|
||||
void e_mod_mixer_card_names_free(Eina_List*);
|
||||
|
||||
int e_mod_mixer_channel_mutable(const E_Mixer_Channel_Info *channel);
|
||||
int e_mod_mixer_channel_is_mono(const E_Mixer_Channel_Info *channel);
|
||||
int e_mod_mixer_channel_has_capture(const E_Mixer_Channel_Info *channel);
|
||||
int e_mod_mixer_channel_has_playback(const E_Mixer_Channel_Info *channel);
|
||||
int e_mod_mixer_channel_is_boost(const E_Mixer_Channel_Info *channel);
|
||||
int e_mod_mixer_channel_has_no_volume(const E_Mixer_Channel_Info *channel);
|
||||
|
||||
void e_mixer_default_setup(void);
|
||||
void e_mixer_pulse_setup();
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ e_mixer_alsa_get_channels(E_Mixer_System *self)
|
|||
for (; elem; elem = snd_mixer_elem_next(elem))
|
||||
{
|
||||
capabilities = _mixer_channel_capabilities(elem);
|
||||
if (capabilities == 0)
|
||||
if (!e_mod_mixer_capabilities_usable(capabilities))
|
||||
continue;
|
||||
|
||||
ch_info = malloc(sizeof(*ch_info));
|
||||
|
@ -438,7 +438,7 @@ e_mixer_alsa_get_channel_by_name(E_Mixer_System *self,
|
|||
{
|
||||
const char *n;
|
||||
capabilities = _mixer_channel_capabilities(elem);
|
||||
if (capabilities == 0)
|
||||
if (!e_mod_mixer_capabilities_usable(capabilities))
|
||||
continue;
|
||||
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
|
|
Loading…
Reference in New Issue