the mixer module was completly inconsistent formated!
-> used "astyle -s3" to format it -> NO CODE CHANGES! SVN revision: 40148
This commit is contained in:
parent
621f39f329
commit
c88ec0590b
|
@ -14,41 +14,41 @@ typedef struct E_Mixer_App_Dialog_Data
|
|||
E_Mixer_Channel_State state;
|
||||
|
||||
struct e_mixer_app_ui
|
||||
{
|
||||
Evas_Object *hlayout;
|
||||
struct e_mixer_app_ui_cards
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *list;
|
||||
} cards;
|
||||
struct e_mixer_app_ui_channels
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *list;
|
||||
} channels;
|
||||
struct e_mixer_app_ui_channel_editor
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *label_card;
|
||||
Evas_Object *card;
|
||||
Evas_Object *label_channel;
|
||||
Evas_Object *channel;
|
||||
Evas_Object *label_type;
|
||||
Evas_Object *type;
|
||||
Evas_Object *label_left;
|
||||
Evas_Object *left;
|
||||
Evas_Object *label_right;
|
||||
Evas_Object *right;
|
||||
Evas_Object *mute;
|
||||
Evas_Object *lock_sliders;
|
||||
} channel_editor;
|
||||
} ui;
|
||||
{
|
||||
Evas_Object *hlayout;
|
||||
struct e_mixer_app_ui_cards
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *list;
|
||||
} cards;
|
||||
struct e_mixer_app_ui_channels
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *list;
|
||||
} channels;
|
||||
struct e_mixer_app_ui_channel_editor
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *label_card;
|
||||
Evas_Object *card;
|
||||
Evas_Object *label_channel;
|
||||
Evas_Object *channel;
|
||||
Evas_Object *label_type;
|
||||
Evas_Object *type;
|
||||
Evas_Object *label_left;
|
||||
Evas_Object *left;
|
||||
Evas_Object *label_right;
|
||||
Evas_Object *right;
|
||||
Evas_Object *mute;
|
||||
Evas_Object *lock_sliders;
|
||||
} channel_editor;
|
||||
} ui;
|
||||
|
||||
struct
|
||||
{
|
||||
void *data;
|
||||
void (*func)(E_Dialog *dialog, void *data);
|
||||
} del;
|
||||
{
|
||||
void *data;
|
||||
void (*func)(E_Dialog *dialog, void *data);
|
||||
} del;
|
||||
} E_Mixer_App_Dialog_Data;
|
||||
|
||||
struct channel_info
|
||||
|
@ -67,14 +67,14 @@ _cb_changed_left(void *data, Evas_Object *obj)
|
|||
|
||||
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_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -85,14 +85,14 @@ _cb_changed_right(void *data, Evas_Object *obj)
|
|||
|
||||
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_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -110,18 +110,18 @@ _cb_changed_lock_sliders(void *data, Evas_Object *obj)
|
|||
E_Mixer_Channel_State *state;
|
||||
|
||||
if (!app->lock_sliders)
|
||||
return;
|
||||
return;
|
||||
|
||||
state = &app->state;
|
||||
if (state->left == state->right)
|
||||
return;
|
||||
return;
|
||||
|
||||
state->left = state->right = (state->left + state->right) / 2;
|
||||
|
||||
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_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||
state->left, state->right);
|
||||
state->left, state->right);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -135,15 +135,15 @@ _update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel
|
|||
e_widget_slider_value_int_set(ui->right, state.right);
|
||||
|
||||
if (e_mixer_system_can_mute(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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -162,9 +162,9 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
|
|||
e_widget_entry_text_set(ui->channel, app->channel_name);
|
||||
|
||||
if (e_mixer_system_has_capture(app->sys, app->channel_info->id))
|
||||
e_widget_entry_text_set(ui->type, _("Capture"));
|
||||
e_widget_entry_text_set(ui->type, _("Capture"));
|
||||
else
|
||||
e_widget_entry_text_set(ui->type, _("Playback"));
|
||||
e_widget_entry_text_set(ui->type, _("Playback"));
|
||||
|
||||
e_mixer_system_get_state(app->sys, app->channel_info->id, &state);
|
||||
_update_channel_editor_state(app, state);
|
||||
|
@ -190,9 +190,9 @@ _channel_info_cmp(const void *data_a, const void *data_b)
|
|||
const struct channel_info *a = data_a, *b = data_b;
|
||||
|
||||
if (a->has_capture < b->has_capture)
|
||||
return -1;
|
||||
return -1;
|
||||
else if (a->has_capture > b->has_capture)
|
||||
return 1;
|
||||
return 1;
|
||||
|
||||
return strcmp(a->name, b->name);
|
||||
}
|
||||
|
@ -205,16 +205,16 @@ _channels_info_new(E_Mixer_System *sys)
|
|||
channels = e_mixer_system_get_channels(sys);
|
||||
channels_infos = NULL;
|
||||
for (l = channels; l != NULL; l = l->next)
|
||||
{
|
||||
struct channel_info *info;
|
||||
{
|
||||
struct channel_info *info;
|
||||
|
||||
info = malloc(sizeof(*info));
|
||||
info->id = l->data;
|
||||
info->name = e_mixer_system_get_channel_name(sys, info->id);
|
||||
info->has_capture = e_mixer_system_has_capture(sys, info->id);
|
||||
info = malloc(sizeof(*info));
|
||||
info->id = l->data;
|
||||
info->name = e_mixer_system_get_channel_name(sys, info->id);
|
||||
info->has_capture = e_mixer_system_has_capture(sys, info->id);
|
||||
|
||||
channels_infos = eina_list_append(channels_infos, info);
|
||||
}
|
||||
channels_infos = eina_list_append(channels_infos, info);
|
||||
}
|
||||
e_mixer_system_free_channels(channels);
|
||||
|
||||
return eina_list_sort(channels_infos, -1, _channel_info_cmp);
|
||||
|
@ -226,10 +226,10 @@ _channels_info_free(Eina_List *list)
|
|||
struct channel_info *info;
|
||||
|
||||
EINA_LIST_FREE(list, info)
|
||||
{
|
||||
eina_stringshare_del(info->name);
|
||||
free(info);
|
||||
}
|
||||
{
|
||||
eina_stringshare_del(info->name);
|
||||
free(info);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -241,7 +241,7 @@ _cb_system_update(void *data, E_Mixer_System *sys)
|
|||
app = data;
|
||||
|
||||
if ((!app->sys) || (!app->channel_info))
|
||||
return 1;
|
||||
return 1;
|
||||
|
||||
e_mixer_system_get_state(app->sys, app->channel_info->id, &state);
|
||||
_update_channel_editor_state(app, state);
|
||||
|
@ -264,7 +264,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
e_widget_ilist_clear(ilist);
|
||||
|
||||
if (app->sys)
|
||||
e_mixer_system_del(app->sys);
|
||||
e_mixer_system_del(app->sys);
|
||||
app->sys = e_mixer_system_new(app->card);
|
||||
e_mixer_system_callback_set(app->sys, _cb_system_update, app);
|
||||
|
||||
|
@ -272,47 +272,47 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
|||
app->channel_name = e_mixer_system_get_default_channel_name(app->sys);
|
||||
|
||||
if (app->channels_infos)
|
||||
_channels_info_free(app->channels_infos);
|
||||
_channels_info_free(app->channels_infos);
|
||||
app->channels_infos = _channels_info_new(app->sys);
|
||||
|
||||
if (app->channels_infos)
|
||||
{
|
||||
struct channel_info *info = app->channels_infos->data;
|
||||
if (info->has_capture)
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||
header_input = 1;
|
||||
i = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Output"));
|
||||
header_input = 0;
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
struct channel_info *info = app->channels_infos->data;
|
||||
if (info->has_capture)
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||
header_input = 1;
|
||||
i = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Output"));
|
||||
header_input = 0;
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (l = app->channels_infos; l != NULL; l = l->next, i++)
|
||||
{
|
||||
struct channel_info *info = l->data;
|
||||
{
|
||||
struct channel_info *info = l->data;
|
||||
|
||||
if ((!header_input) && info->has_capture)
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||
header_input = 1;
|
||||
i++;
|
||||
}
|
||||
if ((!header_input) && info->has_capture)
|
||||
{
|
||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||
header_input = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
info->app = app;
|
||||
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
||||
info, info->name);
|
||||
if (app->channel_name && info->name &&
|
||||
(strcmp(app->channel_name, info->name) == 0))
|
||||
{
|
||||
e_widget_ilist_selected_set(ilist, i);
|
||||
app->channel_info = info;
|
||||
}
|
||||
}
|
||||
info->app = app;
|
||||
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
||||
info, info->name);
|
||||
if (app->channel_name && info->name &&
|
||||
(strcmp(app->channel_name, info->name) == 0))
|
||||
{
|
||||
e_widget_ilist_selected_set(ilist, i);
|
||||
app->channel_info = info;
|
||||
}
|
||||
}
|
||||
|
||||
e_widget_ilist_go(ilist);
|
||||
e_widget_ilist_thaw(ilist);
|
||||
|
@ -342,23 +342,23 @@ _create_cards(E_Dialog *dialog, Evas *evas, E_Mixer_App_Dialog_Data *app)
|
|||
app->card = e_mixer_system_get_default_card();
|
||||
app->cards = e_mixer_system_get_cards();
|
||||
if (eina_list_count(app->cards) < 2)
|
||||
return;
|
||||
return;
|
||||
|
||||
ui = &app->ui.cards;
|
||||
ui->list = e_widget_ilist_add(evas, 32, 32, &app->card);
|
||||
e_widget_min_size_set(ui->list, 180, 100);
|
||||
e_widget_ilist_go(ui->list);
|
||||
EINA_LIST_FOREACH(app->cards, l, card)
|
||||
{
|
||||
const char *card_name;
|
||||
{
|
||||
const char *card_name;
|
||||
|
||||
card_name = e_mixer_system_get_card_name(card);
|
||||
card_name = e_mixer_system_get_card_name(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);
|
||||
e_widget_framelist_object_append(ui->frame, ui->list);
|
||||
|
@ -401,19 +401,19 @@ _create_channel_editor(E_Dialog *dialog, Evas *evas, E_Mixer_App_Dialog_Data *ap
|
|||
|
||||
ui->label_left = e_widget_label_add(evas, _("Left:"));
|
||||
ui->left = e_widget_slider_add(evas, 1, 0, "%3.0f", 0.0, 100.0, 10.0, 100.0,
|
||||
NULL, &app->state.left, 150);
|
||||
NULL, &app->state.left, 150);
|
||||
e_widget_on_change_hook_set(ui->left, _cb_changed_left, app);
|
||||
|
||||
ui->label_right = e_widget_label_add(evas, _("Right:"));
|
||||
ui->right = e_widget_slider_add(evas, 1, 0, "%3.0f", 0.0, 100.0, 10.0, 100.0,
|
||||
NULL, &app->state.right, 150);
|
||||
NULL, &app->state.right, 150);
|
||||
e_widget_on_change_hook_set(ui->right, _cb_changed_right, app);
|
||||
|
||||
ui->mute = e_widget_check_add(evas, _("Mute"), &app->state.mute);
|
||||
e_widget_on_change_hook_set(ui->mute, _cb_changed_mute, app);
|
||||
|
||||
ui->lock_sliders = e_widget_check_add(evas, _("Lock Sliders"),
|
||||
&app->lock_sliders);
|
||||
&app->lock_sliders);
|
||||
e_widget_on_change_hook_set(ui->lock_sliders, _cb_changed_lock_sliders, app);
|
||||
|
||||
ui->frame = e_widget_framelist_add(evas, _("Edit"), 0);
|
||||
|
@ -450,16 +450,16 @@ _create_ui(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
|||
_create_channel_editor(dialog, evas, app);
|
||||
|
||||
if (ui->cards.list)
|
||||
e_widget_ilist_selected_set(ui->cards.list, 0);
|
||||
e_widget_ilist_selected_set(ui->cards.list, 0);
|
||||
else
|
||||
select_card(app);
|
||||
select_card(app);
|
||||
e_widget_ilist_selected_set(ui->channels.list, 1);
|
||||
|
||||
e_widget_min_size_get(ui->hlayout, &mw, &mh);
|
||||
if (mw < 300)
|
||||
mw = 300;
|
||||
mw = 300;
|
||||
if (mh < 200)
|
||||
mh = 200;
|
||||
mh = 200;
|
||||
e_dialog_content_set(dialog, ui->hlayout, mw, mh);
|
||||
}
|
||||
|
||||
|
@ -467,14 +467,14 @@ static void
|
|||
_mixer_app_dialog_del(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
||||
{
|
||||
if (app->del.func)
|
||||
app->del.func(dialog, app->del.data);
|
||||
app->del.func(dialog, app->del.data);
|
||||
|
||||
eina_stringshare_del(app->card);
|
||||
eina_stringshare_del(app->channel_name);
|
||||
if (app->cards)
|
||||
e_mixer_system_free_cards(app->cards);
|
||||
e_mixer_system_free_cards(app->cards);
|
||||
if (app->channels_infos)
|
||||
_channels_info_free(app->channels_infos);
|
||||
_channels_info_free(app->channels_infos);
|
||||
e_mixer_system_del(app->sys);
|
||||
|
||||
e_util_defer_object_del(E_OBJECT(dialog));
|
||||
|
@ -508,14 +508,14 @@ e_mixer_app_dialog_new(E_Container *con, void (*func)(E_Dialog *dialog, void *da
|
|||
|
||||
dialog = e_dialog_new(con, _Name, "e_mixer_app_dialog");
|
||||
if (!dialog)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
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;
|
||||
app->del.data = data;
|
||||
|
@ -535,7 +535,7 @@ e_mixer_app_dialog_new(E_Container *con, void (*func)(E_Dialog *dialog, void *da
|
|||
e_dialog_border_icon_set(dialog, "preferences-desktop-mixer");
|
||||
|
||||
// FIXME: what if module unloaded while mixer_app dialog up? bad!
|
||||
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
@ -546,8 +546,8 @@ _find_card_by_name(E_Mixer_App_Dialog_Data *app, const char *card_name)
|
|||
int i;
|
||||
|
||||
for (i = 0, l = app->cards; l != NULL; i++, l = l->next)
|
||||
if (strcmp(card_name, l->data) == 0)
|
||||
return i;
|
||||
if (strcmp(card_name, l->data) == 0)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -561,26 +561,26 @@ _find_channel_by_name(E_Mixer_App_Dialog_Data *app, const char *channel_name)
|
|||
int header_input;
|
||||
|
||||
if (app->channels_infos)
|
||||
{
|
||||
struct channel_info *info = app->channels_infos->data;
|
||||
{
|
||||
struct channel_info *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;
|
||||
}
|
||||
|
@ -592,21 +592,21 @@ e_mixer_app_dialog_select(E_Dialog *dialog, const char *card_name, const char *c
|
|||
int n;
|
||||
|
||||
if (!dialog)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
app = dialog->data;
|
||||
if (!app)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
n = _find_card_by_name(app, card_name);
|
||||
if (n < 0)
|
||||
return 0;
|
||||
return 0;
|
||||
if (app->ui.cards.list)
|
||||
e_widget_ilist_selected_set(app->ui.cards.list, n);
|
||||
e_widget_ilist_selected_set(app->ui.cards.list, n);
|
||||
|
||||
n = _find_channel_by_name(app, channel_name);
|
||||
if (n < 0)
|
||||
return 0;
|
||||
return 0;
|
||||
e_widget_ilist_selected_set(app->ui.channels.list, n);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -14,28 +14,28 @@ struct _E_Config_Dialog_Data
|
|||
Eina_List *cards_names;
|
||||
Eina_List *channels_names;
|
||||
struct mixer_config_ui
|
||||
{
|
||||
Evas_Object *table;
|
||||
struct mixer_config_ui_general
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *lock_sliders;
|
||||
Evas_Object *show_locked;
|
||||
} general;
|
||||
struct mixer_config_ui_cards
|
||||
{
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} cards;
|
||||
struct mixer_config_ui_channels
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *scroll;
|
||||
Evas_Object *list;
|
||||
E_Radio_Group *radio;
|
||||
Eina_List *radios;
|
||||
} channels;
|
||||
} ui;
|
||||
{
|
||||
Evas_Object *table;
|
||||
struct mixer_config_ui_general
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *lock_sliders;
|
||||
Evas_Object *show_locked;
|
||||
} general;
|
||||
struct mixer_config_ui_cards
|
||||
{
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} cards;
|
||||
struct mixer_config_ui_channels
|
||||
{
|
||||
Evas_Object *frame;
|
||||
Evas_Object *scroll;
|
||||
Evas_Object *list;
|
||||
E_Radio_Group *radio;
|
||||
Eina_List *radios;
|
||||
} channels;
|
||||
} ui;
|
||||
E_Mixer_Gadget_Config *conf;
|
||||
};
|
||||
|
||||
|
@ -51,19 +51,19 @@ _mixer_fill_cards_info(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->cards = e_mixer_system_get_cards();
|
||||
cfdata->cards_names = NULL;
|
||||
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
||||
{
|
||||
name = e_mixer_system_get_card_name(card);
|
||||
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
||||
(strcmp(card, cfdata->card) == 0))
|
||||
cfdata->card_num = i;
|
||||
{
|
||||
name = e_mixer_system_get_card_name(card);
|
||||
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
||||
(strcmp(card, cfdata->card) == 0))
|
||||
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)
|
||||
cfdata->card_num = 0;
|
||||
cfdata->card_num = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -76,23 +76,23 @@ _mixer_fill_channels_info(E_Config_Dialog_Data *cfdata)
|
|||
|
||||
sys = e_mixer_system_new(cfdata->card);
|
||||
if (!sys)
|
||||
return;
|
||||
return;
|
||||
|
||||
cfdata->channel = 0;
|
||||
cfdata->channel_name = eina_stringshare_add(cfdata->conf->channel_name);
|
||||
cfdata->channels_names = e_mixer_system_get_channels_names(sys);
|
||||
EINA_LIST_FOREACH(cfdata->channels_names, l, channel)
|
||||
{
|
||||
if (channel && cfdata->channel_name &&
|
||||
(channel == cfdata->channel_name ||
|
||||
strcmp(channel, cfdata->channel_name) == 0))
|
||||
{
|
||||
cfdata->channel = i;
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (channel && cfdata->channel_name &&
|
||||
(channel == cfdata->channel_name ||
|
||||
strcmp(channel, cfdata->channel_name) == 0))
|
||||
{
|
||||
cfdata->channel = i;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
e_mixer_system_del(sys);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ _create_data(E_Config_Dialog *dialog)
|
|||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
if (!cfdata)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
conf = dialog->data;
|
||||
cfdata->conf = conf;
|
||||
|
@ -125,18 +125,18 @@ _free_data(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
conf = dialog->data;
|
||||
if (conf)
|
||||
conf->dialog = NULL;
|
||||
conf->dialog = NULL;
|
||||
|
||||
if (!cfdata)
|
||||
return;
|
||||
return;
|
||||
|
||||
EINA_LIST_FREE(cfdata->cards_names, card)
|
||||
eina_stringshare_del(card);
|
||||
eina_stringshare_del(card);
|
||||
|
||||
if (cfdata->channels_names)
|
||||
e_mixer_system_free_channels_names(cfdata->channels_names);
|
||||
e_mixer_system_free_channels_names(cfdata->channels_names);
|
||||
if (cfdata->cards)
|
||||
e_mixer_system_free_cards(cfdata->cards);
|
||||
e_mixer_system_free_cards(cfdata->cards);
|
||||
|
||||
eina_stringshare_del(cfdata->card);
|
||||
eina_stringshare_del(cfdata->channel_name);
|
||||
|
@ -158,17 +158,17 @@ _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);
|
||||
return 1;
|
||||
|
@ -193,13 +193,13 @@ _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);
|
||||
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);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ _clear_channels(E_Config_Dialog_Data *cfdata)
|
|||
Evas_Object *o;
|
||||
|
||||
EINA_LIST_FREE(cfdata->ui.channels.radios, o)
|
||||
evas_object_del(o);
|
||||
evas_object_del(o);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -226,32 +226,32 @@ _fill_channels(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ui = &cfdata->ui.channels;
|
||||
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_min_size_get(ui->list, &mw, &mh);
|
||||
evas_object_resize(ui->list, mw, mh);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -262,7 +262,7 @@ _channel_scroll_set_min_size(struct mixer_config_ui_channels *ui)
|
|||
|
||||
len = eina_list_count(ui->radios);
|
||||
if (len < 1)
|
||||
return;
|
||||
return;
|
||||
|
||||
e_widget_min_size_get(ui->list, &w, &h);
|
||||
h = 4 * h / len;
|
||||
|
@ -322,24 +322,24 @@ _basic_create_cards(Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
ui->frame = e_widget_framelist_add(evas, _("Sound Cards"), 0);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
cfdata->ui.table = e_widget_table_add(evas, 0);
|
||||
_basic_create_general(evas, cfdata);
|
||||
|
@ -363,11 +363,11 @@ e_mixer_config_dialog_new(E_Container *con, E_Mixer_Gadget_Config *conf)
|
|||
E_Config_Dialog_View *view;
|
||||
|
||||
if (e_config_dialog_find(_Name, "e_mixer_config_dialog_new"))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
view = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (!view)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
view->create_cfdata = _create_data;
|
||||
view->free_cfdata = _free_data;
|
||||
|
|
|
@ -6,14 +6,14 @@ struct _E_Config_Dialog_Data
|
|||
{
|
||||
int default_instance;
|
||||
struct mixer_config_ui
|
||||
{
|
||||
Evas_Object *list;
|
||||
struct mixer_config_ui_general
|
||||
{
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} general;
|
||||
} ui;
|
||||
{
|
||||
Evas_Object *list;
|
||||
struct mixer_config_ui_general
|
||||
{
|
||||
Evas_Object *frame;
|
||||
E_Radio_Group *radio;
|
||||
} general;
|
||||
} ui;
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -23,7 +23,7 @@ _find_default_instance_index(E_Mixer_Module_Context *ctxt)
|
|||
int i;
|
||||
|
||||
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, i++)
|
||||
if (l->data == ctxt->default_instance)
|
||||
if (l->data == ctxt->default_instance)
|
||||
return i;
|
||||
|
||||
return 0;
|
||||
|
@ -37,7 +37,7 @@ _create_data(E_Config_Dialog *dialog)
|
|||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
if (!cfdata)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
ctxt = dialog->data;
|
||||
cfdata->default_instance = _find_default_instance_index(ctxt);
|
||||
|
@ -52,7 +52,7 @@ _free_data(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
ctxt = dialog->data;
|
||||
if (ctxt)
|
||||
ctxt->conf_dialog = NULL;
|
||||
ctxt->conf_dialog = NULL;
|
||||
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
@ -64,19 +64,19 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
ctxt = dialog->data;
|
||||
ctxt->default_instance = eina_list_nth(ctxt->instances,
|
||||
cfdata->default_instance);
|
||||
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);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -100,23 +100,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 != NULL; 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);
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ cb_mixer_call(void *data, void *data2)
|
|||
E_Container *con;
|
||||
|
||||
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());
|
||||
ctxt->mixer_dialog = e_mixer_app_dialog_new(con, cb_mixer_app_del, ctxt);
|
||||
|
@ -147,18 +147,18 @@ cb_mixer_call(void *data, void *data2)
|
|||
static void
|
||||
_basic_create_mixer_call(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *button;
|
||||
Evas_Object *button;
|
||||
|
||||
button = e_widget_button_add(evas, _("Launch mixer..."), NULL,
|
||||
cb_mixer_call, dialog->data, NULL);
|
||||
e_widget_list_object_append(cfdata->ui.list, button, 0, 0, 0.0);
|
||||
button = e_widget_button_add(evas, _("Launch mixer..."), NULL,
|
||||
cb_mixer_call, dialog->data, NULL);
|
||||
e_widget_list_object_append(cfdata->ui.list, button, 0, 0, 0.0);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
cfdata->ui.list = e_widget_list_add(evas, 0, 0);
|
||||
_basic_create_general(dialog, evas, cfdata);
|
||||
|
@ -173,11 +173,11 @@ e_mixer_config_module_dialog_new(E_Container *con, E_Mixer_Module_Context *ctxt)
|
|||
E_Config_Dialog_View *view;
|
||||
|
||||
if (e_config_dialog_find(_Name, "e_mixer_config_module_dialog_new"))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
view = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (!view)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
view->create_cfdata = _create_data;
|
||||
view->free_cfdata = _free_data;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,9 +22,9 @@ typedef struct E_Mixer_Gadget_Config
|
|||
|
||||
typedef struct E_Mixer_Module_Config
|
||||
{
|
||||
int version;
|
||||
const char *default_gc_id;
|
||||
Eina_Hash *gadgets;
|
||||
int version;
|
||||
const char *default_gc_id;
|
||||
Eina_Hash *gadgets;
|
||||
} E_Mixer_Module_Config;
|
||||
|
||||
typedef struct E_Mixer_Instance
|
||||
|
@ -34,21 +34,21 @@ typedef struct E_Mixer_Instance
|
|||
E_Menu *menu;
|
||||
|
||||
struct
|
||||
{
|
||||
Evas_Object *gadget;
|
||||
Evas_Object *label;
|
||||
Evas_Object *left;
|
||||
Evas_Object *right;
|
||||
Evas_Object *mute;
|
||||
Evas_Object *table;
|
||||
Evas_Object *button;
|
||||
struct
|
||||
{
|
||||
Ecore_X_Window win;
|
||||
Ecore_Event_Handler *mouse_up;
|
||||
Ecore_Event_Handler *key_down;
|
||||
} input;
|
||||
} ui;
|
||||
{
|
||||
Evas_Object *gadget;
|
||||
Evas_Object *label;
|
||||
Evas_Object *left;
|
||||
Evas_Object *right;
|
||||
Evas_Object *mute;
|
||||
Evas_Object *table;
|
||||
Evas_Object *button;
|
||||
struct
|
||||
{
|
||||
Ecore_X_Window win;
|
||||
Ecore_Event_Handler *mouse_up;
|
||||
Ecore_Event_Handler *key_down;
|
||||
} input;
|
||||
} ui;
|
||||
|
||||
E_Mixer_System *sys;
|
||||
E_Mixer_Channel *channel;
|
||||
|
@ -66,11 +66,11 @@ typedef struct E_Mixer_Module_Context
|
|||
Eina_List *instances;
|
||||
E_Dialog *mixer_dialog;
|
||||
struct st_mixer_actions
|
||||
{
|
||||
E_Action *incr;
|
||||
E_Action *decr;
|
||||
E_Action *mute;
|
||||
} actions;
|
||||
{
|
||||
E_Action *incr;
|
||||
E_Action *decr;
|
||||
E_Action *mute;
|
||||
} actions;
|
||||
} E_Mixer_Module_Context;
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
|
|
@ -8,9 +8,9 @@ typedef void E_Mixer_Channel;
|
|||
|
||||
struct E_Mixer_Channel_State
|
||||
{
|
||||
int mute;
|
||||
int left;
|
||||
int right;
|
||||
int mute;
|
||||
int left;
|
||||
int right;
|
||||
};
|
||||
typedef struct E_Mixer_Channel_State E_Mixer_Channel_State;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ _cb_dispatch(void *data)
|
|||
desc->idler = NULL;
|
||||
|
||||
if (!r)
|
||||
_mixer_callback_del(desc->self, desc); /* desc is invalid then. */
|
||||
_mixer_callback_del(desc->self, desc); /* desc is invalid then. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,25 +45,25 @@ _cb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
desc = data;
|
||||
|
||||
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
|
||||
{
|
||||
desc->handlers = eina_list_remove(desc->handlers, fd_handler);
|
||||
if (!desc->handlers)
|
||||
{
|
||||
E_Mixer_System *s;
|
||||
int (*f)(void *, E_Mixer_System *);
|
||||
void *d;
|
||||
{
|
||||
desc->handlers = eina_list_remove(desc->handlers, fd_handler);
|
||||
if (!desc->handlers)
|
||||
{
|
||||
E_Mixer_System *s;
|
||||
int (*f)(void *, E_Mixer_System *);
|
||||
void *d;
|
||||
|
||||
s = desc->self;
|
||||
f = desc->func;
|
||||
d = desc->data;
|
||||
_mixer_callback_del(s, desc);
|
||||
_mixer_callback_add(s, f, d);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
s = desc->self;
|
||||
f = desc->func;
|
||||
d = desc->data;
|
||||
_mixer_callback_del(s, desc);
|
||||
_mixer_callback_add(s, f, d);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!desc->idler)
|
||||
desc->idler = ecore_idler_add(_cb_dispatch, desc);
|
||||
desc->idler = ecore_idler_add(_cb_dispatch, desc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -76,11 +76,11 @@ _mixer_callback_add(E_Mixer_System *self, int (*func)(void *data, E_Mixer_System
|
|||
|
||||
len = snd_mixer_poll_descriptors_count(self);
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
desc = malloc(sizeof(struct e_mixer_callback_desc));
|
||||
if (!desc)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
desc->func = func;
|
||||
desc->data = data;
|
||||
|
@ -91,20 +91,20 @@ _mixer_callback_add(E_Mixer_System *self, int (*func)(void *data, E_Mixer_System
|
|||
pfds = alloca(len * sizeof(struct pollfd));
|
||||
len = snd_mixer_poll_descriptors(self, pfds, len);
|
||||
if (len <= 0)
|
||||
{
|
||||
free(desc);
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
free(desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
Ecore_Fd_Handler *fd_handler;
|
||||
{
|
||||
Ecore_Fd_Handler *fd_handler;
|
||||
|
||||
len--;
|
||||
fd_handler = ecore_main_fd_handler_add(
|
||||
pfds[len].fd, ECORE_FD_READ, _cb_fd_handler, desc, NULL, NULL);
|
||||
desc->handlers = eina_list_prepend(desc->handlers, fd_handler);
|
||||
}
|
||||
len--;
|
||||
fd_handler = ecore_main_fd_handler_add(
|
||||
pfds[len].fd, ECORE_FD_READ, _cb_fd_handler, desc, NULL, NULL);
|
||||
desc->handlers = eina_list_prepend(desc->handlers, fd_handler);
|
||||
}
|
||||
|
||||
snd_mixer_set_callback_private(self, desc);
|
||||
|
||||
|
@ -119,7 +119,7 @@ _mixer_callback_del(E_Mixer_System *self, struct e_mixer_callback_desc *desc)
|
|||
snd_mixer_set_callback_private(self, NULL);
|
||||
|
||||
EINA_LIST_FREE(desc->handlers, handler)
|
||||
ecore_main_fd_handler_del(handler);
|
||||
ecore_main_fd_handler_del(handler);
|
||||
|
||||
free(desc);
|
||||
|
||||
|
@ -142,29 +142,29 @@ e_mixer_system_new(const char *name)
|
|||
int err;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
err = snd_mixer_open(&handle, 0);
|
||||
if (err < 0)
|
||||
goto error_open;
|
||||
goto error_open;
|
||||
|
||||
err = snd_mixer_attach(handle, name);
|
||||
if (err < 0)
|
||||
goto error_load;
|
||||
goto error_load;
|
||||
|
||||
err = snd_mixer_selem_register(handle, NULL, NULL);
|
||||
if (err < 0)
|
||||
goto error_load;
|
||||
goto error_load;
|
||||
|
||||
err = snd_mixer_load(handle);
|
||||
if (err < 0)
|
||||
goto error_load;
|
||||
goto error_load;
|
||||
|
||||
return handle;
|
||||
|
||||
error_load:
|
||||
error_load:
|
||||
snd_mixer_close(handle);
|
||||
error_open:
|
||||
error_open:
|
||||
fprintf(stderr, "MIXER: Cannot get hardware info: %s\n", snd_strerror(err));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -175,11 +175,11 @@ e_mixer_system_del(E_Mixer_System *self)
|
|||
struct e_mixer_callback_desc *desc;
|
||||
|
||||
if (self <= 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
desc = snd_mixer_get_callback_private(self);
|
||||
if (desc)
|
||||
_mixer_callback_del(self, desc);
|
||||
_mixer_callback_del(self, desc);
|
||||
|
||||
snd_mixer_close(self);
|
||||
}
|
||||
|
@ -190,22 +190,22 @@ e_mixer_system_callback_set(E_Mixer_System *self, int (*func)(void *data, E_Mixe
|
|||
struct e_mixer_callback_desc *desc;
|
||||
|
||||
if (!self)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
desc = snd_mixer_get_callback_private(self);
|
||||
if (!desc)
|
||||
{
|
||||
if (func)
|
||||
return _mixer_callback_add(self, func, data);
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
if (func)
|
||||
return _mixer_callback_add(self, func, data);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func)
|
||||
return _mixer_callback_replace(self, desc, func, data);
|
||||
else
|
||||
return _mixer_callback_del(self, desc);
|
||||
}
|
||||
{
|
||||
if (func)
|
||||
return _mixer_callback_replace(self, desc, func, data);
|
||||
else
|
||||
return _mixer_callback_del(self, desc);
|
||||
}
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
|
@ -217,21 +217,21 @@ e_mixer_system_get_cards(void)
|
|||
cards = NULL;
|
||||
card_num = -1;
|
||||
while (((err = snd_card_next(&card_num)) == 0) && (card_num >= 0))
|
||||
{
|
||||
snd_ctl_t *control;
|
||||
char buf[256];
|
||||
{
|
||||
snd_ctl_t *control;
|
||||
char buf[256];
|
||||
|
||||
snprintf(buf, sizeof(buf), "hw:%d", card_num);
|
||||
snprintf(buf, sizeof(buf), "hw:%d", card_num);
|
||||
|
||||
if (snd_ctl_open(&control, buf, 0) < 0)
|
||||
break;
|
||||
snd_ctl_close(control);
|
||||
cards = eina_list_append(cards, eina_stringshare_add(buf));
|
||||
}
|
||||
if (snd_ctl_open(&control, buf, 0) < 0)
|
||||
break;
|
||||
snd_ctl_close(control);
|
||||
cards = eina_list_append(cards, eina_stringshare_add(buf));
|
||||
}
|
||||
|
||||
if (err < 0)
|
||||
fprintf(stderr, "MIXER: Cannot get available card number: %s\n",
|
||||
snd_strerror(err));
|
||||
fprintf(stderr, "MIXER: Cannot get available card number: %s\n",
|
||||
snd_strerror(err));
|
||||
|
||||
return cards;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ e_mixer_system_free_cards(Eina_List *cards)
|
|||
const char *card;
|
||||
|
||||
EINA_LIST_FREE(cards, card)
|
||||
eina_stringshare_del(card);
|
||||
eina_stringshare_del(card);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -252,7 +252,7 @@ e_mixer_system_get_default_card(void)
|
|||
snd_ctl_t *control;
|
||||
|
||||
if (snd_ctl_open(&control, buf, 0) < 0)
|
||||
return NULL;
|
||||
return NULL;
|
||||
snd_ctl_close(control);
|
||||
return eina_stringshare_add(buf);
|
||||
}
|
||||
|
@ -266,30 +266,30 @@ e_mixer_system_get_card_name(const char *card)
|
|||
int err;
|
||||
|
||||
if (!card)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
snd_ctl_card_info_alloca(&hw_info);
|
||||
|
||||
err = snd_ctl_open(&control, card, 0);
|
||||
if (err < 0)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
err = snd_ctl_card_info(control, hw_info);
|
||||
if (err < 0)
|
||||
{
|
||||
fprintf(stderr, "MIXER: Cannot get hardware info: %s: %s\n", card,
|
||||
snd_strerror(err));
|
||||
snd_ctl_close(control);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
fprintf(stderr, "MIXER: Cannot get hardware info: %s: %s\n", card,
|
||||
snd_strerror(err));
|
||||
snd_ctl_close(control);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snd_ctl_close(control);
|
||||
name = snd_ctl_card_info_get_name(hw_info);
|
||||
if (!name)
|
||||
{
|
||||
fprintf(stderr, "MIXER: Cannot get hardware name: %s\n", card);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
fprintf(stderr, "MIXER: Cannot get hardware name: %s\n", card);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return eina_stringshare_add(name);
|
||||
}
|
||||
|
@ -301,19 +301,19 @@ e_mixer_system_get_channels(E_Mixer_System *self)
|
|||
snd_mixer_elem_t *elem;
|
||||
|
||||
if (!self)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
channels = NULL;
|
||||
|
||||
elem = snd_mixer_first_elem(self);
|
||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||
{
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
{
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
|
||||
channels = eina_list_append(channels, elem);
|
||||
}
|
||||
channels = eina_list_append(channels, elem);
|
||||
}
|
||||
|
||||
return channels;
|
||||
}
|
||||
|
@ -332,24 +332,24 @@ e_mixer_system_get_channels_names(E_Mixer_System *self)
|
|||
snd_mixer_selem_id_t *sid;
|
||||
|
||||
if (!self)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
channels = NULL;
|
||||
snd_mixer_selem_id_alloca(&sid);
|
||||
|
||||
elem = snd_mixer_first_elem(self);
|
||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||
{
|
||||
const char *name;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
{
|
||||
const char *name;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
name = snd_mixer_selem_id_get_name(sid);
|
||||
if (name)
|
||||
channels = eina_list_append(channels, eina_stringshare_add(name));
|
||||
}
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
name = snd_mixer_selem_id_get_name(sid);
|
||||
if (name)
|
||||
channels = eina_list_append(channels, eina_stringshare_add(name));
|
||||
}
|
||||
|
||||
return channels;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ e_mixer_system_free_channels_names(Eina_List *channels_names)
|
|||
const char *channel;
|
||||
|
||||
EINA_LIST_FREE(channels_names, channel)
|
||||
eina_stringshare_del(channel);
|
||||
eina_stringshare_del(channel);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -370,23 +370,23 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
|
|||
snd_mixer_selem_id_t *sid;
|
||||
|
||||
if (!self)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
snd_mixer_selem_id_alloca(&sid);
|
||||
|
||||
elem = snd_mixer_first_elem(self);
|
||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||
{
|
||||
const char *name;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
{
|
||||
const char *name;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
name = snd_mixer_selem_id_get_name(sid);
|
||||
if (name)
|
||||
return eina_stringshare_add(name);
|
||||
}
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
name = snd_mixer_selem_id_get_name(sid);
|
||||
if (name)
|
||||
return eina_stringshare_add(name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -398,23 +398,23 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self, const char *name)
|
|||
snd_mixer_selem_id_t *sid;
|
||||
|
||||
if ((!self) || (!name))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
snd_mixer_selem_id_alloca(&sid);
|
||||
|
||||
elem = snd_mixer_first_elem(self);
|
||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||
{
|
||||
const char *n;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
{
|
||||
const char *n;
|
||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||
continue;
|
||||
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
n = snd_mixer_selem_id_get_name(sid);
|
||||
if (n && (strcmp(n, name) == 0))
|
||||
return elem;
|
||||
}
|
||||
snd_mixer_selem_get_id(elem, sid);
|
||||
n = snd_mixer_selem_id_get_name(sid);
|
||||
if (n && (strcmp(n, name) == 0))
|
||||
return elem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
|||
const char *name;
|
||||
|
||||
if ((!self) || (!channel))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
snd_mixer_selem_id_alloca(&sid);
|
||||
snd_mixer_selem_get_id(channel, sid);
|
||||
|
@ -446,27 +446,27 @@ e_mixer_system_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *l
|
|||
long lvol, rvol, range, min, max;
|
||||
|
||||
if ((!self) || (!channel) || (!left) || (!right))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||
range = max - min;
|
||||
if (range < 1)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if (snd_mixer_selem_has_playback_channel(channel, 0))
|
||||
snd_mixer_selem_get_playback_volume(channel, 0, &lvol);
|
||||
snd_mixer_selem_get_playback_volume(channel, 0, &lvol);
|
||||
else
|
||||
lvol = min;
|
||||
lvol = min;
|
||||
|
||||
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
||||
snd_mixer_selem_get_playback_volume(channel, 1, &rvol);
|
||||
snd_mixer_selem_get_playback_volume(channel, 1, &rvol);
|
||||
else
|
||||
rvol = min;
|
||||
rvol = min;
|
||||
|
||||
if (snd_mixer_selem_is_playback_mono(channel) ||
|
||||
snd_mixer_selem_has_playback_volume_joined(channel))
|
||||
rvol = lvol;
|
||||
snd_mixer_selem_has_playback_volume_joined(channel))
|
||||
rvol = lvol;
|
||||
|
||||
*left = rint((double)(lvol - min) * 100 / (double)range);
|
||||
*right = rint((double)(rvol - min) * 100 / (double)range);
|
||||
|
@ -481,44 +481,44 @@ e_mixer_system_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int le
|
|||
int mode;
|
||||
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||
div = 100 + min;
|
||||
if (div == 0)
|
||||
{
|
||||
div = 1; /* no zero-division */
|
||||
min++;
|
||||
}
|
||||
{
|
||||
div = 1; /* no zero-division */
|
||||
min++;
|
||||
}
|
||||
|
||||
range = max - min;
|
||||
if (range < 1)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
mode = 0;
|
||||
if (left >= 0)
|
||||
{
|
||||
left = (((range * left) + (range / 2)) / div) - min;
|
||||
mode |= 1;
|
||||
}
|
||||
{
|
||||
left = (((range * left) + (range / 2)) / div) - min;
|
||||
mode |= 1;
|
||||
}
|
||||
|
||||
if (right >= 0)
|
||||
{
|
||||
right = (((range * right) + (range / 2)) / div) - min;
|
||||
mode |= 2;
|
||||
}
|
||||
{
|
||||
right = (((range * right) + (range / 2)) / div) - min;
|
||||
mode |= 2;
|
||||
}
|
||||
|
||||
if (mode & 1)
|
||||
snd_mixer_selem_set_playback_volume(channel, 0, left);
|
||||
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);
|
||||
}
|
||||
(!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);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -527,33 +527,33 @@ int
|
|||
e_mixer_system_can_mute(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
return (snd_mixer_selem_has_playback_switch(channel) ||
|
||||
snd_mixer_selem_has_playback_switch_joined(channel));
|
||||
snd_mixer_selem_has_playback_switch_joined(channel));
|
||||
}
|
||||
|
||||
int
|
||||
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
||||
{
|
||||
if ((!self) || (!channel) || (!mute))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
snd_mixer_handle_events(self);
|
||||
if (snd_mixer_selem_has_playback_switch(channel) ||
|
||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||
{
|
||||
int m;
|
||||
snd_mixer_selem_has_playback_switch_joined(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);
|
||||
*mute = !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);
|
||||
*mute = !m;
|
||||
}
|
||||
else
|
||||
*mute = 0;
|
||||
*mute = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -562,14 +562,14 @@ int
|
|||
e_mixer_system_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int mute)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
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);
|
||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||
return snd_mixer_selem_set_playback_switch_all(channel, !mute);
|
||||
else
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -578,7 +578,7 @@ e_mixer_system_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer
|
|||
int r;
|
||||
|
||||
if (!state)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
r = e_mixer_system_get_mute(self, channel, &state->mute);
|
||||
r &= e_mixer_system_get_volume(self, channel, &state->left, &state->right);
|
||||
|
@ -591,7 +591,7 @@ e_mixer_system_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E
|
|||
int r;
|
||||
|
||||
if (!state)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
r = e_mixer_system_set_mute(self, channel, state->mute);
|
||||
r &= e_mixer_system_set_volume(self, channel, state->left, state->right);
|
||||
|
@ -602,7 +602,7 @@ int
|
|||
e_mixer_system_has_capture(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||
{
|
||||
if ((!self) || (!channel))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
return snd_mixer_selem_has_capture_switch(channel);
|
||||
}
|
||||
|
|
|
@ -16,9 +16,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
|
||||
|
@ -60,9 +60,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 *
|
||||
|
@ -105,9 +105,9 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self, const char *name)
|
|||
_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
|
||||
|
@ -119,18 +119,18 @@ const char *
|
|||
e_mixer_system_get_channel_name(E_Mixer_System *self, 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, E_Mixer_Channel *channel, int *left, int *right)
|
||||
{
|
||||
if (left)
|
||||
*left = 0;
|
||||
*left = 0;
|
||||
if (right)
|
||||
*right = 0;
|
||||
*right = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ int
|
|||
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
||||
{
|
||||
if (mute)
|
||||
*mute = 1;
|
||||
*mute = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ e_mixer_system_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer
|
|||
const E_Mixer_Channel_State def = {1, 0, 0};
|
||||
|
||||
if (state)
|
||||
*state = def;
|
||||
*state = def;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue