forked from enlightenment/enlightenment
parent
2f2764c63a
commit
f1c170da5a
|
@ -4,13 +4,13 @@ extern const char _e_mixer_Name[];
|
|||
|
||||
typedef struct E_Mixer_App_Dialog_Data
|
||||
{
|
||||
E_Mixer_System *sys;
|
||||
const char *card;
|
||||
const char *channel_name;
|
||||
int lock_sliders;
|
||||
Eina_List *cards;
|
||||
Eina_List *channels_infos;
|
||||
struct channel_info *channel_info;
|
||||
E_Mixer_System *sys;
|
||||
const char *card;
|
||||
const char *channel_name;
|
||||
int lock_sliders;
|
||||
Eina_List *cards;
|
||||
Eina_List *channels_infos;
|
||||
struct channel_info *channel_info;
|
||||
E_Mixer_Channel_State state;
|
||||
|
||||
struct e_mixer_app_ui
|
||||
|
@ -53,9 +53,9 @@ typedef struct E_Mixer_App_Dialog_Data
|
|||
|
||||
struct channel_info
|
||||
{
|
||||
int has_capture;
|
||||
const char *name;
|
||||
E_Mixer_Channel *id;
|
||||
int has_capture;
|
||||
const char *name;
|
||||
E_Mixer_Channel *id;
|
||||
E_Mixer_App_Dialog_Data *app;
|
||||
};
|
||||
|
||||
|
@ -68,13 +68,13 @@ _cb_changed_left(void *data, Evas_Object *obj __UNUSED__)
|
|||
state = &app->state;
|
||||
if (app->lock_sliders && (state->left != state->right))
|
||||
{
|
||||
state->right = state->left;
|
||||
e_widget_slider_value_int_set(app->ui.channel_editor.right,
|
||||
state->right);
|
||||
state->right = 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,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -86,13 +86,13 @@ _cb_changed_right(void *data, Evas_Object *obj __UNUSED__)
|
|||
state = &app->state;
|
||||
if (app->lock_sliders && (state->right != state->left))
|
||||
{
|
||||
state->left = state->right;
|
||||
e_widget_slider_value_int_set(app->ui.channel_editor.left,
|
||||
state->left);
|
||||
state->left = state->right;
|
||||
e_widget_slider_value_int_set(app->ui.channel_editor.left,
|
||||
state->left);
|
||||
}
|
||||
|
||||
e_mod_mixer_volume_set(app->sys, app->channel_info->id,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -121,7 +121,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,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -134,13 +134,13 @@ _update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel
|
|||
|
||||
if (e_mod_mixer_mutable_get(app->sys, app->channel_info->id))
|
||||
{
|
||||
e_widget_disabled_set(ui->mute, 0);
|
||||
e_widget_check_checked_set(ui->mute, state.mute);
|
||||
e_widget_disabled_set(ui->mute, 0);
|
||||
e_widget_check_checked_set(ui->mute, state.mute);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_disabled_set(ui->mute, 1);
|
||||
e_widget_check_checked_set(ui->mute, 0);
|
||||
e_widget_disabled_set(ui->mute, 1);
|
||||
e_widget_check_checked_set(ui->mute, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,14 +202,14 @@ _channels_info_new(E_Mixer_System *sys)
|
|||
channels_infos = NULL;
|
||||
for (l = channels; l; l = l->next)
|
||||
{
|
||||
struct channel_info *info;
|
||||
struct channel_info *info;
|
||||
|
||||
info = malloc(sizeof(*info));
|
||||
info->id = l->data;
|
||||
info->name = e_mod_mixer_channel_name_get(sys, info->id);
|
||||
info->has_capture = e_mod_mixer_capture_get(sys, info->id);
|
||||
info = malloc(sizeof(*info));
|
||||
info->id = l->data;
|
||||
info->name = e_mod_mixer_channel_name_get(sys, info->id);
|
||||
info->has_capture = e_mod_mixer_capture_get(sys, info->id);
|
||||
|
||||
channels_infos = eina_list_append(channels_infos, info);
|
||||
channels_infos = eina_list_append(channels_infos, info);
|
||||
}
|
||||
e_mod_mixer_channels_free(channels);
|
||||
|
||||
|
@ -223,8 +223,8 @@ _channels_info_free(Eina_List *list)
|
|||
|
||||
EINA_LIST_FREE(list, info)
|
||||
{
|
||||
eina_stringshare_del(info->name);
|
||||
free(info);
|
||||
eina_stringshare_del(info->name);
|
||||
free(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
|
||||
eina_stringshare_del(app->channel_name);
|
||||
app->channel_name = e_mod_mixer_channel_default_name_get(app->sys);
|
||||
|
||||
|
||||
if (app->channels_infos)
|
||||
_channels_info_free(app->channels_infos);
|
||||
app->channels_infos = _channels_info_new(app->sys);
|
||||
|
@ -299,9 +299,9 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
|
||||
info->app = app;
|
||||
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
||||
info, info->name);
|
||||
info, info->name);
|
||||
if (app->channel_name && info->name &&
|
||||
(strcmp(app->channel_name, info->name) == 0))
|
||||
(strcmp(app->channel_name, info->name) == 0))
|
||||
{
|
||||
e_widget_ilist_selected_set(ilist, i);
|
||||
app->channel_info = info;
|
||||
|
@ -343,14 +343,14 @@ _create_cards(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *
|
|||
e_widget_ilist_go(ui->list);
|
||||
EINA_LIST_FOREACH(app->cards, l, card)
|
||||
{
|
||||
const char *card_name;
|
||||
const char *card_name;
|
||||
|
||||
card_name = e_mod_mixer_card_name_get(card);
|
||||
card_name = e_mod_mixer_card_name_get(card);
|
||||
|
||||
e_widget_ilist_append(ui->list, NULL, card_name, _cb_card_selected,
|
||||
app, card);
|
||||
e_widget_ilist_append(ui->list, NULL, card_name, _cb_card_selected,
|
||||
app, card);
|
||||
|
||||
eina_stringshare_del(card_name);
|
||||
eina_stringshare_del(card_name);
|
||||
}
|
||||
|
||||
ui->frame = e_widget_framelist_add(evas, _("Cards"), 0);
|
||||
|
@ -496,8 +496,8 @@ e_mixer_app_dialog_new(E_Container *con, void (*func)(E_Dialog *dialog, void *da
|
|||
app = E_NEW(E_Mixer_App_Dialog_Data, 1);
|
||||
if (!app)
|
||||
{
|
||||
e_object_del(E_OBJECT(dialog));
|
||||
return NULL;
|
||||
e_object_del(E_OBJECT(dialog));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dialog->data = app;
|
||||
|
@ -547,22 +547,22 @@ _find_channel_by_name(E_Mixer_App_Dialog_Data *app, const char *channel_name)
|
|||
{
|
||||
info = app->channels_infos->data;
|
||||
|
||||
header_input = !!info->has_capture;
|
||||
i = 1;
|
||||
header_input = !!info->has_capture;
|
||||
i = 1;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(app->channels_infos, l, info)
|
||||
{
|
||||
if ((!header_input) && info->has_capture)
|
||||
{
|
||||
header_input = 1;
|
||||
i++;
|
||||
}
|
||||
if ((!header_input) && info->has_capture)
|
||||
{
|
||||
header_input = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (strcmp(channel_name, info->name) == 0)
|
||||
return i;
|
||||
if (strcmp(channel_name, info->name) == 0)
|
||||
return i;
|
||||
|
||||
++i;
|
||||
++i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -594,3 +594,4 @@ e_mixer_app_dialog_select(E_Dialog *dialog, const char *card_name, const char *c
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ extern const char _e_mixer_Name[];
|
|||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
int lock_sliders;
|
||||
int show_locked;
|
||||
int keybindings_popup;
|
||||
int card_num;
|
||||
int channel;
|
||||
int lock_sliders;
|
||||
int show_locked;
|
||||
int keybindings_popup;
|
||||
int card_num;
|
||||
int channel;
|
||||
const char *card;
|
||||
const char *channel_name;
|
||||
Eina_List *cards;
|
||||
Eina_List *cards_names;
|
||||
Eina_List *channels_names;
|
||||
Eina_List *cards;
|
||||
Eina_List *cards_names;
|
||||
Eina_List *channels_names;
|
||||
struct mixer_config_ui
|
||||
{
|
||||
Evas_Object *table;
|
||||
|
@ -26,16 +26,16 @@ struct _E_Config_Dialog_Data
|
|||
} general;
|
||||
struct mixer_config_ui_cards
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} cards;
|
||||
struct mixer_config_ui_channels
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *scroll;
|
||||
Evas_Object *list;
|
||||
Evas_Object *frame;
|
||||
Evas_Object *scroll;
|
||||
Evas_Object *list;
|
||||
E_Radio_Group *radio;
|
||||
Eina_List *radios;
|
||||
Eina_List *radios;
|
||||
} channels;
|
||||
} ui;
|
||||
E_Mixer_Gadget_Config *conf;
|
||||
|
@ -54,14 +54,14 @@ _mixer_fill_cards_info(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->cards_names = NULL;
|
||||
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
||||
{
|
||||
name = e_mod_mixer_card_name_get(card);
|
||||
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
||||
name = e_mod_mixer_card_name_get(card);
|
||||
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
||||
(strcmp(card, cfdata->card) == 0))
|
||||
cfdata->card_num = i;
|
||||
cfdata->card_num = i;
|
||||
|
||||
cfdata->cards_names = eina_list_append(cfdata->cards_names, name);
|
||||
cfdata->cards_names = eina_list_append(cfdata->cards_names, name);
|
||||
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (cfdata->card_num < 0)
|
||||
|
@ -85,15 +85,15 @@ _mixer_fill_channels_info(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->channels_names = e_mod_mixer_channels_names_get(sys);
|
||||
EINA_LIST_FOREACH(cfdata->channels_names, l, channel)
|
||||
{
|
||||
if (channel && cfdata->channel_name &&
|
||||
if (channel && cfdata->channel_name &&
|
||||
(channel == cfdata->channel_name ||
|
||||
strcmp(channel, cfdata->channel_name) == 0))
|
||||
{
|
||||
cfdata->channel = i;
|
||||
break;
|
||||
}
|
||||
{
|
||||
cfdata->channel = i;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
e_mod_mixer_del(sys);
|
||||
}
|
||||
|
@ -161,15 +161,15 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
card = eina_list_nth(cfdata->cards, cfdata->card_num);
|
||||
if (card)
|
||||
{
|
||||
eina_stringshare_del(conf->card);
|
||||
conf->card = eina_stringshare_ref(card);
|
||||
eina_stringshare_del(conf->card);
|
||||
conf->card = eina_stringshare_ref(card);
|
||||
}
|
||||
|
||||
channel = eina_list_nth(cfdata->channels_names, cfdata->channel);
|
||||
if (channel)
|
||||
{
|
||||
eina_stringshare_del(conf->channel_name);
|
||||
conf->channel_name = eina_stringshare_ref(channel);
|
||||
eina_stringshare_del(conf->channel_name);
|
||||
conf->channel_name = eina_stringshare_ref(channel);
|
||||
}
|
||||
|
||||
e_mixer_update(conf->instance);
|
||||
|
@ -191,18 +191,18 @@ _basic_create_general(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ui->frame = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
|
||||
ui->lock_sliders = e_widget_check_add(
|
||||
evas, _("Lock Sliders"), &cfdata->lock_sliders);
|
||||
evas, _("Lock Sliders"), &cfdata->lock_sliders);
|
||||
evas_object_smart_callback_add(
|
||||
ui->lock_sliders, "changed", _lock_change, cfdata);
|
||||
ui->lock_sliders, "changed", _lock_change, cfdata);
|
||||
e_widget_framelist_object_append(ui->frame, ui->lock_sliders);
|
||||
|
||||
ui->show_locked = e_widget_check_add(
|
||||
evas, _("Show both sliders when locked"), &cfdata->show_locked);
|
||||
evas, _("Show both sliders when locked"), &cfdata->show_locked);
|
||||
e_widget_disabled_set(ui->show_locked, !cfdata->lock_sliders);
|
||||
e_widget_framelist_object_append(ui->frame, ui->show_locked);
|
||||
|
||||
ui->keybindings_popup = e_widget_check_add(
|
||||
evas, _("Show Popup on volume change via keybindings"), &cfdata->keybindings_popup);
|
||||
evas, _("Show Popup on volume change via keybindings"), &cfdata->keybindings_popup);
|
||||
e_widget_framelist_object_append(ui->frame, ui->keybindings_popup);
|
||||
}
|
||||
|
||||
|
@ -228,15 +228,15 @@ _fill_channels(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ui->radio = e_widget_radio_group_new(&cfdata->channel);
|
||||
EINA_LIST_FOREACH(cfdata->channels_names, l, name)
|
||||
{
|
||||
Evas_Object *ow;
|
||||
Evas_Object *ow;
|
||||
|
||||
if (!name) continue;
|
||||
if (!name) continue;
|
||||
|
||||
ow = e_widget_radio_add(evas, name, i, ui->radio);
|
||||
ui->radios = eina_list_append(ui->radios, ow);
|
||||
e_widget_list_object_append(ui->list, ow, 1, 1, 0.0);
|
||||
ow = e_widget_radio_add(evas, name, i, ui->radio);
|
||||
ui->radios = eina_list_append(ui->radios, ow);
|
||||
e_widget_list_object_append(ui->list, ow, 1, 1, 0.0);
|
||||
|
||||
++i;
|
||||
++i;
|
||||
}
|
||||
|
||||
e_widget_size_min_get(ui->list, &mw, &mh);
|
||||
|
@ -245,13 +245,13 @@ _fill_channels(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
selected = eina_list_nth(ui->radios, cfdata->channel);
|
||||
if (selected)
|
||||
{
|
||||
Evas_Coord x, y, w, h, lx, ly;
|
||||
evas_object_geometry_get(selected, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(ui->list, &lx, &ly, NULL, NULL);
|
||||
x -= lx;
|
||||
y -= ly - 10;
|
||||
h += 20;
|
||||
e_widget_scrollframe_child_region_show(ui->scroll, x, y, w, h);
|
||||
Evas_Coord x, y, w, h, lx, ly;
|
||||
evas_object_geometry_get(selected, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(ui->list, &lx, &ly, NULL, NULL);
|
||||
x -= lx;
|
||||
y -= ly - 10;
|
||||
h += 20;
|
||||
e_widget_scrollframe_child_region_show(ui->scroll, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,15 +317,15 @@ _basic_create_cards(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ui->radio = e_widget_radio_group_new(&cfdata->card_num);
|
||||
EINA_LIST_FOREACH(cfdata->cards_names, l, card)
|
||||
{
|
||||
Evas_Object *ow;
|
||||
Evas_Object *ow;
|
||||
|
||||
if (!card) continue;
|
||||
if (!card) continue;
|
||||
|
||||
ow = e_widget_radio_add(evas, card, i, ui->radio);
|
||||
e_widget_framelist_object_append(ui->frame, ow);
|
||||
evas_object_smart_callback_add(ow, "changed", _card_change, cfdata);
|
||||
ow = e_widget_radio_add(evas, card, i, ui->radio);
|
||||
e_widget_framelist_object_append(ui->frame, ow);
|
||||
evas_object_smart_callback_add(ow, "changed", _card_change, cfdata);
|
||||
|
||||
++i;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,6 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
void
|
||||
e_mixer_config_pulse_toggle(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
E_Config_Dialog *
|
||||
|
@ -381,3 +380,4 @@ e_mixer_config_dialog_new(E_Container *con, E_Mixer_Gadget_Config *conf)
|
|||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ struct _E_Config_Dialog_Data
|
|||
Evas_Object *list;
|
||||
struct mixer_config_ui_general
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} general;
|
||||
} ui;
|
||||
|
@ -63,15 +63,15 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
cfdata->default_instance);
|
||||
if (ctxt->default_instance)
|
||||
{
|
||||
E_Mixer_Module_Config *conf;
|
||||
const char *id;
|
||||
E_Mixer_Module_Config *conf;
|
||||
const char *id;
|
||||
|
||||
conf = ctxt->conf;
|
||||
if (conf->default_gc_id)
|
||||
eina_stringshare_del(conf->default_gc_id);
|
||||
conf = ctxt->conf;
|
||||
if (conf->default_gc_id)
|
||||
eina_stringshare_del(conf->default_gc_id);
|
||||
|
||||
id = ctxt->default_instance->gcc->cf->id;
|
||||
conf->default_gc_id = eina_stringshare_add(id);
|
||||
id = ctxt->default_instance->gcc->cf->id;
|
||||
conf->default_gc_id = eina_stringshare_add(id);
|
||||
|
||||
conf->desktop_notification = ctxt->desktop_notification;
|
||||
}
|
||||
|
@ -96,24 +96,23 @@ _basic_create_general(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data
|
|||
ui->radio = e_widget_radio_group_new(&cfdata->default_instance);
|
||||
for (i = 0, l = ctxt->instances; l; l = l->next, i++)
|
||||
{
|
||||
E_Mixer_Instance *inst;
|
||||
E_Mixer_Gadget_Config *conf;
|
||||
Evas_Object *o;
|
||||
char name[128];
|
||||
const char *card_name;
|
||||
E_Mixer_Instance *inst;
|
||||
E_Mixer_Gadget_Config *conf;
|
||||
Evas_Object *o;
|
||||
char name[128];
|
||||
const char *card_name;
|
||||
|
||||
inst = l->data;
|
||||
conf = inst->conf;
|
||||
inst = l->data;
|
||||
conf = inst->conf;
|
||||
|
||||
card_name = e_mixer_system_get_card_name(conf->card);
|
||||
snprintf(name, sizeof(name), "%s: %s", card_name, conf->channel_name);
|
||||
eina_stringshare_del(card_name);
|
||||
card_name = e_mixer_system_get_card_name(conf->card);
|
||||
snprintf(name, sizeof(name), "%s: %s", card_name, conf->channel_name);
|
||||
eina_stringshare_del(card_name);
|
||||
|
||||
o = e_widget_radio_add(evas, name, i, ui->radio);
|
||||
e_widget_framelist_object_append(ui->frame, o);
|
||||
o = e_widget_radio_add(evas, name, i, ui->radio);
|
||||
e_widget_framelist_object_append(ui->frame, o);
|
||||
}
|
||||
|
||||
|
||||
e_widget_list_object_append(cfdata->ui.list, ui->frame, 1, 1, 0.5);
|
||||
chk = e_widget_check_add(evas, _("Display desktop notifications on volume change"), &ctxt->desktop_notification);
|
||||
e_widget_check_checked_set(chk, ctxt->conf->desktop_notification);
|
||||
|
@ -138,8 +137,8 @@ cb_mixer_call(void *data, void *data2 __UNUSED__)
|
|||
|
||||
if (ctxt->mixer_dialog)
|
||||
{
|
||||
e_dialog_show(ctxt->mixer_dialog);
|
||||
return;
|
||||
e_dialog_show(ctxt->mixer_dialog);
|
||||
return;
|
||||
}
|
||||
|
||||
con = e_container_current_get(e_manager_current_get());
|
||||
|
@ -192,3 +191,4 @@ e_mixer_config_module_dialog_new(E_Container *con, E_Mixer_Module_Context *ctxt)
|
|||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ struct e_mixer_callback_desc
|
|||
static int _mixer_callback_add(E_Mixer_System *self,
|
||||
int (*func)(void *data, E_Mixer_System *self),
|
||||
void *data);
|
||||
static int _mixer_callback_del(E_Mixer_System *self,
|
||||
static int _mixer_callback_del(E_Mixer_System *self,
|
||||
struct e_mixer_callback_desc *desc);
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -37,7 +37,7 @@ _cb_dispatch(void *data)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_fd_handler(void *data,
|
||||
_cb_fd_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
struct e_mixer_callback_desc *desc;
|
||||
|
@ -115,7 +115,7 @@ _mixer_callback_add(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
static int
|
||||
_mixer_callback_del(E_Mixer_System *self,
|
||||
_mixer_callback_del(E_Mixer_System *self,
|
||||
struct e_mixer_callback_desc *desc)
|
||||
{
|
||||
Ecore_Fd_Handler *handler;
|
||||
|
@ -402,7 +402,7 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
|
|||
|
||||
E_Mixer_Channel *
|
||||
e_mixer_system_get_channel_by_name(E_Mixer_System *self,
|
||||
const char *name)
|
||||
const char *name)
|
||||
{
|
||||
snd_mixer_elem_t *elem;
|
||||
snd_mixer_selem_id_t *sid;
|
||||
|
@ -435,7 +435,7 @@ e_mixer_system_channel_del(E_Mixer_Channel *channel __UNUSED__)
|
|||
}
|
||||
|
||||
const char *
|
||||
e_mixer_system_get_channel_name(E_Mixer_System *self,
|
||||
e_mixer_system_get_channel_name(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel)
|
||||
{
|
||||
snd_mixer_selem_id_t *sid;
|
||||
|
@ -452,10 +452,10 @@ e_mixer_system_get_channel_name(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_get_volume(E_Mixer_System *self,
|
||||
e_mixer_system_get_volume(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
int *left,
|
||||
int *right)
|
||||
int *left,
|
||||
int *right)
|
||||
{
|
||||
long lvol, rvol, range, min, max;
|
||||
|
||||
|
@ -489,10 +489,10 @@ e_mixer_system_get_volume(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_set_volume(E_Mixer_System *self,
|
||||
e_mixer_system_set_volume(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
int left,
|
||||
int right)
|
||||
int left,
|
||||
int right)
|
||||
{
|
||||
long range, min, max, divide;
|
||||
int mode;
|
||||
|
@ -541,7 +541,7 @@ e_mixer_system_set_volume(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_can_mute(E_Mixer_System *self,
|
||||
e_mixer_system_can_mute(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
|
@ -553,9 +553,9 @@ e_mixer_system_can_mute(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_get_mute(E_Mixer_System *self,
|
||||
e_mixer_system_get_mute(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
int *mute)
|
||||
int *mute)
|
||||
{
|
||||
if ((!self) || (!channel) || (!mute))
|
||||
return 0;
|
||||
|
@ -579,9 +579,9 @@ e_mixer_system_get_mute(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_set_mute(E_Mixer_System *self,
|
||||
e_mixer_system_set_mute(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
int mute)
|
||||
int mute)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
|
@ -595,8 +595,8 @@ e_mixer_system_set_mute(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_get_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
e_mixer_system_get_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
E_Mixer_Channel_State *state)
|
||||
{
|
||||
int r;
|
||||
|
@ -610,8 +610,8 @@ e_mixer_system_get_state(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_set_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
e_mixer_system_set_state(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel,
|
||||
const E_Mixer_Channel_State *state)
|
||||
{
|
||||
int r;
|
||||
|
@ -625,7 +625,7 @@ e_mixer_system_set_state(E_Mixer_System *self,
|
|||
}
|
||||
|
||||
int
|
||||
e_mixer_system_has_capture(E_Mixer_System *self,
|
||||
e_mixer_system_has_capture(E_Mixer_System *self,
|
||||
E_Mixer_Channel *channel)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
|
|
|
@ -14,9 +14,9 @@ e_mixer_system_new(const char *name)
|
|||
_e_mixer_dummy_set();
|
||||
|
||||
if (name == _name || strcmp(name, _name) == 0)
|
||||
return (E_Mixer_System *)-1;
|
||||
return (E_Mixer_System *)-1;
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -58,9 +58,9 @@ e_mixer_system_get_card_name(const char *card)
|
|||
_e_mixer_dummy_set();
|
||||
|
||||
if (card == _name || strcmp(card, _name) == 0)
|
||||
return eina_stringshare_ref(_name);
|
||||
return eina_stringshare_ref(_name);
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
|
@ -103,9 +103,9 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self __UNUSED__, const char *
|
|||
_e_mixer_dummy_set();
|
||||
|
||||
if (name == _name || strcmp(name, _name) == 0)
|
||||
return (E_Mixer_Channel *)-2;
|
||||
return (E_Mixer_Channel *)-2;
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,18 +117,18 @@ const char *
|
|||
e_mixer_system_get_channel_name(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel)
|
||||
{
|
||||
if (channel == (E_Mixer_Channel *)-2)
|
||||
return eina_stringshare_ref(_name);
|
||||
return eina_stringshare_ref(_name);
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_system_get_volume(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__, int *left, int *right)
|
||||
{
|
||||
if (left)
|
||||
*left = 0;
|
||||
*left = 0;
|
||||
if (right)
|
||||
*right = 0;
|
||||
*right = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ int
|
|||
e_mixer_system_get_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__, int *mute)
|
||||
{
|
||||
if (mute)
|
||||
*mute = 1;
|
||||
*mute = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ e_mixer_system_get_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *chann
|
|||
const E_Mixer_Channel_State def = {1, 0, 0};
|
||||
|
||||
if (state)
|
||||
*state = def;
|
||||
*state = def;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -182,3 +182,4 @@ e_mixer_system_has_capture(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *cha
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
//#define BAD_CH_MAPPING 1
|
||||
|
||||
#define PULSE_BUS "org.PulseAudio.Core1"
|
||||
#define PULSE_PATH "/org/pulseaudio/core1"
|
||||
#define PULSE_BUS "org.PulseAudio.Core1"
|
||||
#define PULSE_PATH "/org/pulseaudio/core1"
|
||||
#define PULSE_INTERFACE "org.PulseAudio.Core1"
|
||||
|
||||
static Pulse *conn = NULL;
|
||||
|
@ -69,7 +69,7 @@ _dbus_poll(void *data __UNUSED__,
|
|||
static void
|
||||
_dbus_test(void *data __UNUSED__,
|
||||
DBusMessage *msg __UNUSED__,
|
||||
DBusError *error)
|
||||
DBusError *error)
|
||||
{
|
||||
if ((error) && (dbus_error_is_set(error)))
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ _pulse_sinks_get(Pulse *p __UNUSED__, Pulse_Tag_Id id __UNUSED__, Eina_List *ev)
|
|||
printf("\tavg: %g\n", pulse_sink_avg_get_pct(sink));
|
||||
printf("\tbalance: %f\n", pulse_sink_balance_get(sink));
|
||||
}
|
||||
*/
|
||||
*/
|
||||
sinks = ev;
|
||||
pulse_sinks_watch(conn);
|
||||
e_mod_mixer_pulse_ready(EINA_TRUE);
|
||||
|
@ -140,7 +140,7 @@ _pulse_sources_get(Pulse *p __UNUSED__, Pulse_Tag_Id id __UNUSED__, Eina_List *e
|
|||
printf("\tavg: %g\n", pulse_sink_avg_get_pct(sink));
|
||||
printf("\tbalance: %f\n", pulse_sink_balance_get(sink));
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -313,7 +313,7 @@ e_mixer_pulse_shutdown(void)
|
|||
E_Mixer_System *
|
||||
e_mixer_pulse_new(const char *name)
|
||||
{
|
||||
return (E_Mixer_System*)_pulse_sink_find(name);
|
||||
return (E_Mixer_System *)_pulse_sink_find(name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -387,14 +387,15 @@ e_mixer_pulse_get_channels_names(E_Mixer_System *self)
|
|||
#else
|
||||
(void)self;
|
||||
return eina_list_append(NULL, eina_stringshare_add("Output"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
e_mixer_pulse_free_channels_names(Eina_List *channels_names)
|
||||
{
|
||||
const char *str;
|
||||
EINA_LIST_FREE(channels_names, str) eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(channels_names, str)
|
||||
eina_stringshare_del(str);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -405,7 +406,7 @@ e_mixer_pulse_get_default_channel_name(E_Mixer_System *self)
|
|||
#else
|
||||
(void)self;
|
||||
return eina_stringshare_add("Output");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
E_Mixer_Channel *
|
||||
|
@ -419,7 +420,7 @@ e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name)
|
|||
#else
|
||||
(void)self, (void)name;
|
||||
return (E_Mixer_Channel *)1;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -432,33 +433,33 @@ e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
|||
{
|
||||
if (!channel) return NULL;
|
||||
#ifdef BAD_CH_MAPPING
|
||||
return pulse_sink_channel_id_get_name((void *)self,
|
||||
return pulse_sink_channel_id_get_name((void *)self,
|
||||
((uintptr_t)channel) - 1);
|
||||
#else
|
||||
(void)self;
|
||||
return eina_stringshare_add("Output");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right)
|
||||
{
|
||||
double volume;
|
||||
|
||||
|
||||
#ifdef BAD_CH_MAPPING
|
||||
if (!channel) return 0;
|
||||
volume = pulse_sink_channel_volume_get((void *)self,
|
||||
volume = pulse_sink_channel_volume_get((void *)self,
|
||||
((uintptr_t)channel) - 1);
|
||||
if (left) *left = (int)volume;
|
||||
if (right) *right = (int)volume;
|
||||
#else
|
||||
int x, n;
|
||||
|
||||
|
||||
if (!channel) return 0;
|
||||
n = pulse_sink_channels_count((void *)self);
|
||||
for (x = 0; x < n; x++)
|
||||
{
|
||||
volume = pulse_sink_channel_volume_get((void *)self,
|
||||
volume = pulse_sink_channel_volume_get((void *)self,
|
||||
((uintptr_t)channel) - 1);
|
||||
if (x == 0)
|
||||
{
|
||||
|
@ -469,7 +470,7 @@ e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *le
|
|||
if (right) *right = (int)volume;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -480,16 +481,16 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
|
|||
|
||||
#ifdef BAD_CH_MAPPING
|
||||
if (!channel) return 0;
|
||||
id = pulse_type_channel_volume_set(conn, (void *)self,
|
||||
((uintptr_t)channel) - 1,
|
||||
id = pulse_type_channel_volume_set(conn, (void *)self,
|
||||
((uintptr_t)channel) - 1,
|
||||
(left + right) / 2, source);
|
||||
if (!id) return 0;
|
||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||
#else
|
||||
int x, n;
|
||||
|
||||
|
||||
if (!channel) return 0;
|
||||
n = pulse_sink_channels_count((void *)self);
|
||||
n = pulse_sink_channels_count((void *)self);
|
||||
for (x = 0; x < n; x++)
|
||||
{
|
||||
if (x == 0)
|
||||
|
@ -501,7 +502,7 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
|
|||
id |= pulse_sink_channel_volume_set(conn, (void *)self, x, right);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -538,7 +539,7 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_
|
|||
double vol;
|
||||
if (!state) return 0;
|
||||
if (!channel) return 0;
|
||||
vol = pulse_sink_channel_volume_get((void *)self,
|
||||
vol = pulse_sink_channel_volume_get((void *)self,
|
||||
((uintptr_t)channel) - 1);
|
||||
state->mute = pulse_sink_muted_get((void *)self);
|
||||
state->left = state->right = (int)vol;
|
||||
|
@ -547,7 +548,7 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_
|
|||
if (!channel) return 0;
|
||||
e_mixer_pulse_get_mute(self, channel, &(state->mute));
|
||||
e_mixer_pulse_get_volume(self, channel, &(state->left), &(state->right));
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -559,15 +560,15 @@ e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_
|
|||
Eina_Bool source = EINA_FALSE;
|
||||
if (!channel) return 0;
|
||||
source = !!eina_list_data_find(sources, self);
|
||||
id = pulse_type_channel_volume_set(conn, (void *)self,
|
||||
((uintptr_t)channel) - 1,
|
||||
id = pulse_type_channel_volume_set(conn, (void *)self,
|
||||
((uintptr_t)channel) - 1,
|
||||
(state->left + state->right) / 2, source);
|
||||
if (!id) return 0;
|
||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||
#else
|
||||
e_mixer_pulse_set_volume(self, channel, state->left, state->right);
|
||||
e_mixer_pulse_set_mute(self, channel, state->mute);
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -576,3 +577,4 @@ e_mixer_pulse_has_capture(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *chan
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue