forked from enlightenment/enlightenment
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;
|
E_Mixer_Channel_State state;
|
||||||
|
|
||||||
struct e_mixer_app_ui
|
struct e_mixer_app_ui
|
||||||
{
|
{
|
||||||
Evas_Object *hlayout;
|
Evas_Object *hlayout;
|
||||||
struct e_mixer_app_ui_cards
|
struct e_mixer_app_ui_cards
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
Evas_Object *list;
|
Evas_Object *list;
|
||||||
} cards;
|
} cards;
|
||||||
struct e_mixer_app_ui_channels
|
struct e_mixer_app_ui_channels
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
Evas_Object *list;
|
Evas_Object *list;
|
||||||
} channels;
|
} channels;
|
||||||
struct e_mixer_app_ui_channel_editor
|
struct e_mixer_app_ui_channel_editor
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
Evas_Object *label_card;
|
Evas_Object *label_card;
|
||||||
Evas_Object *card;
|
Evas_Object *card;
|
||||||
Evas_Object *label_channel;
|
Evas_Object *label_channel;
|
||||||
Evas_Object *channel;
|
Evas_Object *channel;
|
||||||
Evas_Object *label_type;
|
Evas_Object *label_type;
|
||||||
Evas_Object *type;
|
Evas_Object *type;
|
||||||
Evas_Object *label_left;
|
Evas_Object *label_left;
|
||||||
Evas_Object *left;
|
Evas_Object *left;
|
||||||
Evas_Object *label_right;
|
Evas_Object *label_right;
|
||||||
Evas_Object *right;
|
Evas_Object *right;
|
||||||
Evas_Object *mute;
|
Evas_Object *mute;
|
||||||
Evas_Object *lock_sliders;
|
Evas_Object *lock_sliders;
|
||||||
} channel_editor;
|
} channel_editor;
|
||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
void (*func)(E_Dialog *dialog, void *data);
|
void (*func)(E_Dialog *dialog, void *data);
|
||||||
} del;
|
} del;
|
||||||
} E_Mixer_App_Dialog_Data;
|
} E_Mixer_App_Dialog_Data;
|
||||||
|
|
||||||
struct channel_info
|
struct channel_info
|
||||||
|
@ -67,14 +67,14 @@ _cb_changed_left(void *data, Evas_Object *obj)
|
||||||
|
|
||||||
state = &app->state;
|
state = &app->state;
|
||||||
if (app->lock_sliders && (state->left != state->right))
|
if (app->lock_sliders && (state->left != state->right))
|
||||||
{
|
{
|
||||||
state->right = state->left;
|
state->right = state->left;
|
||||||
e_widget_slider_value_int_set(app->ui.channel_editor.right,
|
e_widget_slider_value_int_set(app->ui.channel_editor.right,
|
||||||
state->right);
|
state->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||||
state->left, state->right);
|
state->left, state->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -85,14 +85,14 @@ _cb_changed_right(void *data, Evas_Object *obj)
|
||||||
|
|
||||||
state = &app->state;
|
state = &app->state;
|
||||||
if (app->lock_sliders && (state->right != state->left))
|
if (app->lock_sliders && (state->right != state->left))
|
||||||
{
|
{
|
||||||
state->left = state->right;
|
state->left = state->right;
|
||||||
e_widget_slider_value_int_set(app->ui.channel_editor.left,
|
e_widget_slider_value_int_set(app->ui.channel_editor.left,
|
||||||
state->left);
|
state->left);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||||
state->left, state->right);
|
state->left, state->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -110,18 +110,18 @@ _cb_changed_lock_sliders(void *data, Evas_Object *obj)
|
||||||
E_Mixer_Channel_State *state;
|
E_Mixer_Channel_State *state;
|
||||||
|
|
||||||
if (!app->lock_sliders)
|
if (!app->lock_sliders)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = &app->state;
|
state = &app->state;
|
||||||
if (state->left == state->right)
|
if (state->left == state->right)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state->left = state->right = (state->left + state->right) / 2;
|
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.left, state->left);
|
||||||
e_widget_slider_value_int_set(app->ui.channel_editor.right, state->right);
|
e_widget_slider_value_int_set(app->ui.channel_editor.right, state->right);
|
||||||
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
e_mixer_system_set_volume(app->sys, app->channel_info->id,
|
||||||
state->left, state->right);
|
state->left, state->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
e_widget_slider_value_int_set(ui->right, state.right);
|
||||||
|
|
||||||
if (e_mixer_system_can_mute(app->sys, app->channel_info->id))
|
if (e_mixer_system_can_mute(app->sys, app->channel_info->id))
|
||||||
{
|
{
|
||||||
e_widget_disabled_set(ui->mute, 0);
|
e_widget_disabled_set(ui->mute, 0);
|
||||||
e_widget_check_checked_set(ui->mute, state.mute);
|
e_widget_check_checked_set(ui->mute, state.mute);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e_widget_disabled_set(ui->mute, 1);
|
e_widget_disabled_set(ui->mute, 1);
|
||||||
e_widget_check_checked_set(ui->mute, 0);
|
e_widget_check_checked_set(ui->mute, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
e_widget_entry_text_set(ui->channel, app->channel_name);
|
||||||
|
|
||||||
if (e_mixer_system_has_capture(app->sys, app->channel_info->id))
|
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
|
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);
|
e_mixer_system_get_state(app->sys, app->channel_info->id, &state);
|
||||||
_update_channel_editor_state(app, 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;
|
const struct channel_info *a = data_a, *b = data_b;
|
||||||
|
|
||||||
if (a->has_capture < b->has_capture)
|
if (a->has_capture < b->has_capture)
|
||||||
return -1;
|
return -1;
|
||||||
else if (a->has_capture > b->has_capture)
|
else if (a->has_capture > b->has_capture)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return strcmp(a->name, b->name);
|
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 = e_mixer_system_get_channels(sys);
|
||||||
channels_infos = NULL;
|
channels_infos = NULL;
|
||||||
for (l = channels; l != NULL; l = l->next)
|
for (l = channels; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
struct channel_info *info;
|
struct channel_info *info;
|
||||||
|
|
||||||
info = malloc(sizeof(*info));
|
info = malloc(sizeof(*info));
|
||||||
info->id = l->data;
|
info->id = l->data;
|
||||||
info->name = e_mixer_system_get_channel_name(sys, info->id);
|
info->name = e_mixer_system_get_channel_name(sys, info->id);
|
||||||
info->has_capture = e_mixer_system_has_capture(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);
|
e_mixer_system_free_channels(channels);
|
||||||
|
|
||||||
return eina_list_sort(channels_infos, -1, _channel_info_cmp);
|
return eina_list_sort(channels_infos, -1, _channel_info_cmp);
|
||||||
|
@ -226,10 +226,10 @@ _channels_info_free(Eina_List *list)
|
||||||
struct channel_info *info;
|
struct channel_info *info;
|
||||||
|
|
||||||
EINA_LIST_FREE(list, info)
|
EINA_LIST_FREE(list, info)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(info->name);
|
eina_stringshare_del(info->name);
|
||||||
free(info);
|
free(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -241,7 +241,7 @@ _cb_system_update(void *data, E_Mixer_System *sys)
|
||||||
app = data;
|
app = data;
|
||||||
|
|
||||||
if ((!app->sys) || (!app->channel_info))
|
if ((!app->sys) || (!app->channel_info))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
e_mixer_system_get_state(app->sys, app->channel_info->id, &state);
|
e_mixer_system_get_state(app->sys, app->channel_info->id, &state);
|
||||||
_update_channel_editor_state(app, state);
|
_update_channel_editor_state(app, state);
|
||||||
|
@ -264,7 +264,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
||||||
e_widget_ilist_clear(ilist);
|
e_widget_ilist_clear(ilist);
|
||||||
|
|
||||||
if (app->sys)
|
if (app->sys)
|
||||||
e_mixer_system_del(app->sys);
|
e_mixer_system_del(app->sys);
|
||||||
app->sys = e_mixer_system_new(app->card);
|
app->sys = e_mixer_system_new(app->card);
|
||||||
e_mixer_system_callback_set(app->sys, _cb_system_update, app);
|
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);
|
app->channel_name = e_mixer_system_get_default_channel_name(app->sys);
|
||||||
|
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
_channels_info_free(app->channels_infos);
|
_channels_info_free(app->channels_infos);
|
||||||
app->channels_infos = _channels_info_new(app->sys);
|
app->channels_infos = _channels_info_new(app->sys);
|
||||||
|
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
{
|
{
|
||||||
struct channel_info *info = app->channels_infos->data;
|
struct channel_info *info = app->channels_infos->data;
|
||||||
if (info->has_capture)
|
if (info->has_capture)
|
||||||
{
|
{
|
||||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||||
header_input = 1;
|
header_input = 1;
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e_widget_ilist_header_append(ilist, NULL, _("Output"));
|
e_widget_ilist_header_append(ilist, NULL, _("Output"));
|
||||||
header_input = 0;
|
header_input = 0;
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = app->channels_infos; l != NULL; l = l->next, i++)
|
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)
|
if ((!header_input) && info->has_capture)
|
||||||
{
|
{
|
||||||
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
e_widget_ilist_header_append(ilist, NULL, _("Input"));
|
||||||
header_input = 1;
|
header_input = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->app = app;
|
info->app = app;
|
||||||
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
||||||
info, info->name);
|
info, info->name);
|
||||||
if (app->channel_name && 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);
|
e_widget_ilist_selected_set(ilist, i);
|
||||||
app->channel_info = info;
|
app->channel_info = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e_widget_ilist_go(ilist);
|
e_widget_ilist_go(ilist);
|
||||||
e_widget_ilist_thaw(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->card = e_mixer_system_get_default_card();
|
||||||
app->cards = e_mixer_system_get_cards();
|
app->cards = e_mixer_system_get_cards();
|
||||||
if (eina_list_count(app->cards) < 2)
|
if (eina_list_count(app->cards) < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui = &app->ui.cards;
|
ui = &app->ui.cards;
|
||||||
ui->list = e_widget_ilist_add(evas, 32, 32, &app->card);
|
ui->list = e_widget_ilist_add(evas, 32, 32, &app->card);
|
||||||
e_widget_min_size_set(ui->list, 180, 100);
|
e_widget_min_size_set(ui->list, 180, 100);
|
||||||
e_widget_ilist_go(ui->list);
|
e_widget_ilist_go(ui->list);
|
||||||
EINA_LIST_FOREACH(app->cards, l, card)
|
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,
|
e_widget_ilist_append(ui->list, NULL, card_name, _cb_card_selected,
|
||||||
app, card);
|
app, card);
|
||||||
|
|
||||||
eina_stringshare_del(card_name);
|
eina_stringshare_del(card_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->frame = e_widget_framelist_add(evas, _("Cards"), 0);
|
ui->frame = e_widget_framelist_add(evas, _("Cards"), 0);
|
||||||
e_widget_framelist_object_append(ui->frame, ui->list);
|
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->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,
|
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);
|
e_widget_on_change_hook_set(ui->left, _cb_changed_left, app);
|
||||||
|
|
||||||
ui->label_right = e_widget_label_add(evas, _("Right:"));
|
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,
|
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);
|
e_widget_on_change_hook_set(ui->right, _cb_changed_right, app);
|
||||||
|
|
||||||
ui->mute = e_widget_check_add(evas, _("Mute"), &app->state.mute);
|
ui->mute = e_widget_check_add(evas, _("Mute"), &app->state.mute);
|
||||||
e_widget_on_change_hook_set(ui->mute, _cb_changed_mute, app);
|
e_widget_on_change_hook_set(ui->mute, _cb_changed_mute, app);
|
||||||
|
|
||||||
ui->lock_sliders = e_widget_check_add(evas, _("Lock Sliders"),
|
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);
|
e_widget_on_change_hook_set(ui->lock_sliders, _cb_changed_lock_sliders, app);
|
||||||
|
|
||||||
ui->frame = e_widget_framelist_add(evas, _("Edit"), 0);
|
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);
|
_create_channel_editor(dialog, evas, app);
|
||||||
|
|
||||||
if (ui->cards.list)
|
if (ui->cards.list)
|
||||||
e_widget_ilist_selected_set(ui->cards.list, 0);
|
e_widget_ilist_selected_set(ui->cards.list, 0);
|
||||||
else
|
else
|
||||||
select_card(app);
|
select_card(app);
|
||||||
e_widget_ilist_selected_set(ui->channels.list, 1);
|
e_widget_ilist_selected_set(ui->channels.list, 1);
|
||||||
|
|
||||||
e_widget_min_size_get(ui->hlayout, &mw, &mh);
|
e_widget_min_size_get(ui->hlayout, &mw, &mh);
|
||||||
if (mw < 300)
|
if (mw < 300)
|
||||||
mw = 300;
|
mw = 300;
|
||||||
if (mh < 200)
|
if (mh < 200)
|
||||||
mh = 200;
|
mh = 200;
|
||||||
e_dialog_content_set(dialog, ui->hlayout, mw, mh);
|
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)
|
_mixer_app_dialog_del(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
||||||
{
|
{
|
||||||
if (app->del.func)
|
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->card);
|
||||||
eina_stringshare_del(app->channel_name);
|
eina_stringshare_del(app->channel_name);
|
||||||
if (app->cards)
|
if (app->cards)
|
||||||
e_mixer_system_free_cards(app->cards);
|
e_mixer_system_free_cards(app->cards);
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
_channels_info_free(app->channels_infos);
|
_channels_info_free(app->channels_infos);
|
||||||
e_mixer_system_del(app->sys);
|
e_mixer_system_del(app->sys);
|
||||||
|
|
||||||
e_util_defer_object_del(E_OBJECT(dialog));
|
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");
|
dialog = e_dialog_new(con, _Name, "e_mixer_app_dialog");
|
||||||
if (!dialog)
|
if (!dialog)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
app = E_NEW(E_Mixer_App_Dialog_Data, 1);
|
app = E_NEW(E_Mixer_App_Dialog_Data, 1);
|
||||||
if (!app)
|
if (!app)
|
||||||
{
|
{
|
||||||
e_object_del(E_OBJECT(dialog));
|
e_object_del(E_OBJECT(dialog));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->data = app;
|
dialog->data = app;
|
||||||
app->del.data = data;
|
app->del.data = data;
|
||||||
|
@ -546,8 +546,8 @@ _find_card_by_name(E_Mixer_App_Dialog_Data *app, const char *card_name)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0, l = app->cards; l != NULL; i++, l = l->next)
|
for (i = 0, l = app->cards; l != NULL; i++, l = l->next)
|
||||||
if (strcmp(card_name, l->data) == 0)
|
if (strcmp(card_name, l->data) == 0)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -561,26 +561,26 @@ _find_channel_by_name(E_Mixer_App_Dialog_Data *app, const char *channel_name)
|
||||||
int header_input;
|
int header_input;
|
||||||
|
|
||||||
if (app->channels_infos)
|
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;
|
header_input = !!info->has_capture;
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(app->channels_infos, l, info)
|
EINA_LIST_FOREACH(app->channels_infos, l, info)
|
||||||
{
|
{
|
||||||
if ((!header_input) && info->has_capture)
|
if ((!header_input) && info->has_capture)
|
||||||
{
|
{
|
||||||
header_input = 1;
|
header_input = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(channel_name, info->name) == 0)
|
if (strcmp(channel_name, info->name) == 0)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -592,21 +592,21 @@ e_mixer_app_dialog_select(E_Dialog *dialog, const char *card_name, const char *c
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (!dialog)
|
if (!dialog)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
app = dialog->data;
|
app = dialog->data;
|
||||||
if (!app)
|
if (!app)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
n = _find_card_by_name(app, card_name);
|
n = _find_card_by_name(app, card_name);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (app->ui.cards.list)
|
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);
|
n = _find_channel_by_name(app, channel_name);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return 0;
|
return 0;
|
||||||
e_widget_ilist_selected_set(app->ui.channels.list, n);
|
e_widget_ilist_selected_set(app->ui.channels.list, n);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -14,28 +14,28 @@ struct _E_Config_Dialog_Data
|
||||||
Eina_List *cards_names;
|
Eina_List *cards_names;
|
||||||
Eina_List *channels_names;
|
Eina_List *channels_names;
|
||||||
struct mixer_config_ui
|
struct mixer_config_ui
|
||||||
{
|
{
|
||||||
Evas_Object *table;
|
Evas_Object *table;
|
||||||
struct mixer_config_ui_general
|
struct mixer_config_ui_general
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
Evas_Object *lock_sliders;
|
Evas_Object *lock_sliders;
|
||||||
Evas_Object *show_locked;
|
Evas_Object *show_locked;
|
||||||
} general;
|
} general;
|
||||||
struct mixer_config_ui_cards
|
struct mixer_config_ui_cards
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
E_Radio_Group *radio;
|
E_Radio_Group *radio;
|
||||||
} cards;
|
} cards;
|
||||||
struct mixer_config_ui_channels
|
struct mixer_config_ui_channels
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
Evas_Object *scroll;
|
Evas_Object *scroll;
|
||||||
Evas_Object *list;
|
Evas_Object *list;
|
||||||
E_Radio_Group *radio;
|
E_Radio_Group *radio;
|
||||||
Eina_List *radios;
|
Eina_List *radios;
|
||||||
} channels;
|
} channels;
|
||||||
} ui;
|
} ui;
|
||||||
E_Mixer_Gadget_Config *conf;
|
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 = e_mixer_system_get_cards();
|
||||||
cfdata->cards_names = NULL;
|
cfdata->cards_names = NULL;
|
||||||
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
||||||
{
|
{
|
||||||
name = e_mixer_system_get_card_name(card);
|
name = e_mixer_system_get_card_name(card);
|
||||||
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
if ((cfdata->card_num < 0) && card && cfdata->card &&
|
||||||
(strcmp(card, cfdata->card) == 0))
|
(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)
|
if (cfdata->card_num < 0)
|
||||||
cfdata->card_num = 0;
|
cfdata->card_num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -76,23 +76,23 @@ _mixer_fill_channels_info(E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
sys = e_mixer_system_new(cfdata->card);
|
sys = e_mixer_system_new(cfdata->card);
|
||||||
if (!sys)
|
if (!sys)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cfdata->channel = 0;
|
cfdata->channel = 0;
|
||||||
cfdata->channel_name = eina_stringshare_add(cfdata->conf->channel_name);
|
cfdata->channel_name = eina_stringshare_add(cfdata->conf->channel_name);
|
||||||
cfdata->channels_names = e_mixer_system_get_channels_names(sys);
|
cfdata->channels_names = e_mixer_system_get_channels_names(sys);
|
||||||
EINA_LIST_FOREACH(cfdata->channels_names, l, channel)
|
EINA_LIST_FOREACH(cfdata->channels_names, l, channel)
|
||||||
{
|
{
|
||||||
if (channel && cfdata->channel_name &&
|
if (channel && cfdata->channel_name &&
|
||||||
(channel == cfdata->channel_name ||
|
(channel == cfdata->channel_name ||
|
||||||
strcmp(channel, cfdata->channel_name) == 0))
|
strcmp(channel, cfdata->channel_name) == 0))
|
||||||
{
|
{
|
||||||
cfdata->channel = i;
|
cfdata->channel = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
e_mixer_system_del(sys);
|
e_mixer_system_del(sys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ _create_data(E_Config_Dialog *dialog)
|
||||||
|
|
||||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
if (!cfdata)
|
if (!cfdata)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
conf = dialog->data;
|
conf = dialog->data;
|
||||||
cfdata->conf = conf;
|
cfdata->conf = conf;
|
||||||
|
@ -125,18 +125,18 @@ _free_data(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
conf = dialog->data;
|
conf = dialog->data;
|
||||||
if (conf)
|
if (conf)
|
||||||
conf->dialog = NULL;
|
conf->dialog = NULL;
|
||||||
|
|
||||||
if (!cfdata)
|
if (!cfdata)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EINA_LIST_FREE(cfdata->cards_names, card)
|
EINA_LIST_FREE(cfdata->cards_names, card)
|
||||||
eina_stringshare_del(card);
|
eina_stringshare_del(card);
|
||||||
|
|
||||||
if (cfdata->channels_names)
|
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)
|
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->card);
|
||||||
eina_stringshare_del(cfdata->channel_name);
|
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);
|
card = eina_list_nth(cfdata->cards, cfdata->card_num);
|
||||||
if (card)
|
if (card)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(conf->card);
|
eina_stringshare_del(conf->card);
|
||||||
conf->card = eina_stringshare_ref(card);
|
conf->card = eina_stringshare_ref(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = eina_list_nth(cfdata->channels_names, cfdata->channel);
|
channel = eina_list_nth(cfdata->channels_names, cfdata->channel);
|
||||||
if (channel)
|
if (channel)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(conf->channel_name);
|
eina_stringshare_del(conf->channel_name);
|
||||||
conf->channel_name = eina_stringshare_ref(channel);
|
conf->channel_name = eina_stringshare_ref(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_mixer_update(conf->instance);
|
e_mixer_update(conf->instance);
|
||||||
return 1;
|
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->frame = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||||
|
|
||||||
ui->lock_sliders = e_widget_check_add(
|
ui->lock_sliders = e_widget_check_add(
|
||||||
evas, _("Lock Sliders"), &cfdata->lock_sliders);
|
evas, _("Lock Sliders"), &cfdata->lock_sliders);
|
||||||
evas_object_smart_callback_add(
|
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);
|
e_widget_framelist_object_append(ui->frame, ui->lock_sliders);
|
||||||
|
|
||||||
ui->show_locked = e_widget_check_add(
|
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_disabled_set(ui->show_locked, !cfdata->lock_sliders);
|
||||||
e_widget_framelist_object_append(ui->frame, ui->show_locked);
|
e_widget_framelist_object_append(ui->frame, ui->show_locked);
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ _clear_channels(E_Config_Dialog_Data *cfdata)
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
|
|
||||||
EINA_LIST_FREE(cfdata->ui.channels.radios, o)
|
EINA_LIST_FREE(cfdata->ui.channels.radios, o)
|
||||||
evas_object_del(o);
|
evas_object_del(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -226,32 +226,32 @@ _fill_channels(Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
ui = &cfdata->ui.channels;
|
ui = &cfdata->ui.channels;
|
||||||
ui->radio = e_widget_radio_group_new(&cfdata->channel);
|
ui->radio = e_widget_radio_group_new(&cfdata->channel);
|
||||||
EINA_LIST_FOREACH(cfdata->channels_names, l, name)
|
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);
|
ow = e_widget_radio_add(evas, name, i, ui->radio);
|
||||||
ui->radios = eina_list_append(ui->radios, ow);
|
ui->radios = eina_list_append(ui->radios, ow);
|
||||||
e_widget_list_object_append(ui->list, ow, 1, 1, 0.0);
|
e_widget_list_object_append(ui->list, ow, 1, 1, 0.0);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
e_widget_min_size_get(ui->list, &mw, &mh);
|
e_widget_min_size_get(ui->list, &mw, &mh);
|
||||||
evas_object_resize(ui->list, mw, mh);
|
evas_object_resize(ui->list, mw, mh);
|
||||||
|
|
||||||
selected = eina_list_nth(ui->radios, cfdata->channel);
|
selected = eina_list_nth(ui->radios, cfdata->channel);
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h, lx, ly;
|
Evas_Coord x, y, w, h, lx, ly;
|
||||||
evas_object_geometry_get(selected, &x, &y, &w, &h);
|
evas_object_geometry_get(selected, &x, &y, &w, &h);
|
||||||
evas_object_geometry_get(ui->list, &lx, &ly, NULL, NULL);
|
evas_object_geometry_get(ui->list, &lx, &ly, NULL, NULL);
|
||||||
x -= lx;
|
x -= lx;
|
||||||
y -= ly - 10;
|
y -= ly - 10;
|
||||||
h += 20;
|
h += 20;
|
||||||
e_widget_scrollframe_child_region_show(ui->scroll, x, y, w, h);
|
e_widget_scrollframe_child_region_show(ui->scroll, x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -262,7 +262,7 @@ _channel_scroll_set_min_size(struct mixer_config_ui_channels *ui)
|
||||||
|
|
||||||
len = eina_list_count(ui->radios);
|
len = eina_list_count(ui->radios);
|
||||||
if (len < 1)
|
if (len < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
e_widget_min_size_get(ui->list, &w, &h);
|
e_widget_min_size_get(ui->list, &w, &h);
|
||||||
h = 4 * h / len;
|
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->frame = e_widget_framelist_add(evas, _("Sound Cards"), 0);
|
||||||
ui->radio = e_widget_radio_group_new(&cfdata->card_num);
|
ui->radio = e_widget_radio_group_new(&cfdata->card_num);
|
||||||
EINA_LIST_FOREACH(cfdata->cards_names, l, card)
|
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);
|
ow = e_widget_radio_add(evas, card, i, ui->radio);
|
||||||
e_widget_framelist_object_append(ui->frame, ow);
|
e_widget_framelist_object_append(ui->frame, ow);
|
||||||
evas_object_smart_callback_add(ow, "changed", _card_change, cfdata);
|
evas_object_smart_callback_add(ow, "changed", _card_change, cfdata);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
if (!cfdata)
|
if (!cfdata)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cfdata->ui.table = e_widget_table_add(evas, 0);
|
cfdata->ui.table = e_widget_table_add(evas, 0);
|
||||||
_basic_create_general(evas, cfdata);
|
_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;
|
E_Config_Dialog_View *view;
|
||||||
|
|
||||||
if (e_config_dialog_find(_Name, "e_mixer_config_dialog_new"))
|
if (e_config_dialog_find(_Name, "e_mixer_config_dialog_new"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view = E_NEW(E_Config_Dialog_View, 1);
|
view = E_NEW(E_Config_Dialog_View, 1);
|
||||||
if (!view)
|
if (!view)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view->create_cfdata = _create_data;
|
view->create_cfdata = _create_data;
|
||||||
view->free_cfdata = _free_data;
|
view->free_cfdata = _free_data;
|
||||||
|
|
|
@ -6,14 +6,14 @@ struct _E_Config_Dialog_Data
|
||||||
{
|
{
|
||||||
int default_instance;
|
int default_instance;
|
||||||
struct mixer_config_ui
|
struct mixer_config_ui
|
||||||
{
|
{
|
||||||
Evas_Object *list;
|
Evas_Object *list;
|
||||||
struct mixer_config_ui_general
|
struct mixer_config_ui_general
|
||||||
{
|
{
|
||||||
Evas_Object *frame;
|
Evas_Object *frame;
|
||||||
E_Radio_Group *radio;
|
E_Radio_Group *radio;
|
||||||
} general;
|
} general;
|
||||||
} ui;
|
} ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -23,7 +23,7 @@ _find_default_instance_index(E_Mixer_Module_Context *ctxt)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, 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 i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -37,7 +37,7 @@ _create_data(E_Config_Dialog *dialog)
|
||||||
|
|
||||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
if (!cfdata)
|
if (!cfdata)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ctxt = dialog->data;
|
ctxt = dialog->data;
|
||||||
cfdata->default_instance = _find_default_instance_index(ctxt);
|
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;
|
ctxt = dialog->data;
|
||||||
if (ctxt)
|
if (ctxt)
|
||||||
ctxt->conf_dialog = NULL;
|
ctxt->conf_dialog = NULL;
|
||||||
|
|
||||||
E_FREE(cfdata);
|
E_FREE(cfdata);
|
||||||
}
|
}
|
||||||
|
@ -64,19 +64,19 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
ctxt = dialog->data;
|
ctxt = dialog->data;
|
||||||
ctxt->default_instance = eina_list_nth(ctxt->instances,
|
ctxt->default_instance = eina_list_nth(ctxt->instances,
|
||||||
cfdata->default_instance);
|
cfdata->default_instance);
|
||||||
if (ctxt->default_instance)
|
if (ctxt->default_instance)
|
||||||
{
|
{
|
||||||
E_Mixer_Module_Config *conf;
|
E_Mixer_Module_Config *conf;
|
||||||
const char *id;
|
const char *id;
|
||||||
|
|
||||||
conf = ctxt->conf;
|
conf = ctxt->conf;
|
||||||
if (conf->default_gc_id)
|
if (conf->default_gc_id)
|
||||||
eina_stringshare_del(conf->default_gc_id);
|
eina_stringshare_del(conf->default_gc_id);
|
||||||
|
|
||||||
id = ctxt->default_instance->gcc->cf->id;
|
id = ctxt->default_instance->gcc->cf->id;
|
||||||
conf->default_gc_id = eina_stringshare_add(id);
|
conf->default_gc_id = eina_stringshare_add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
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);
|
ui->radio = e_widget_radio_group_new(&cfdata->default_instance);
|
||||||
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, i++)
|
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, i++)
|
||||||
{
|
{
|
||||||
E_Mixer_Instance *inst;
|
E_Mixer_Instance *inst;
|
||||||
E_Mixer_Gadget_Config *conf;
|
E_Mixer_Gadget_Config *conf;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char name[128];
|
char name[128];
|
||||||
const char *card_name;
|
const char *card_name;
|
||||||
|
|
||||||
inst = l->data;
|
inst = l->data;
|
||||||
conf = inst->conf;
|
conf = inst->conf;
|
||||||
|
|
||||||
card_name = e_mixer_system_get_card_name(conf->card);
|
card_name = e_mixer_system_get_card_name(conf->card);
|
||||||
snprintf(name, sizeof(name), "%s: %s", card_name, conf->channel_name);
|
snprintf(name, sizeof(name), "%s: %s", card_name, conf->channel_name);
|
||||||
eina_stringshare_del(card_name);
|
eina_stringshare_del(card_name);
|
||||||
|
|
||||||
o = e_widget_radio_add(evas, name, i, ui->radio);
|
o = e_widget_radio_add(evas, name, i, ui->radio);
|
||||||
e_widget_framelist_object_append(ui->frame, o);
|
e_widget_framelist_object_append(ui->frame, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_widget_list_object_append(cfdata->ui.list, ui->frame, 1, 1, 0.5);
|
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;
|
E_Container *con;
|
||||||
|
|
||||||
if (ctxt->mixer_dialog)
|
if (ctxt->mixer_dialog)
|
||||||
{
|
{
|
||||||
e_dialog_show(ctxt->mixer_dialog);
|
e_dialog_show(ctxt->mixer_dialog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
con = e_container_current_get(e_manager_current_get());
|
con = e_container_current_get(e_manager_current_get());
|
||||||
ctxt->mixer_dialog = e_mixer_app_dialog_new(con, cb_mixer_app_del, ctxt);
|
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
|
static void
|
||||||
_basic_create_mixer_call(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_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,
|
button = e_widget_button_add(evas, _("Launch mixer..."), NULL,
|
||||||
cb_mixer_call, dialog->data, NULL);
|
cb_mixer_call, dialog->data, NULL);
|
||||||
e_widget_list_object_append(cfdata->ui.list, button, 0, 0, 0.0);
|
e_widget_list_object_append(cfdata->ui.list, button, 0, 0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
if (!cfdata)
|
if (!cfdata)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cfdata->ui.list = e_widget_list_add(evas, 0, 0);
|
cfdata->ui.list = e_widget_list_add(evas, 0, 0);
|
||||||
_basic_create_general(dialog, evas, cfdata);
|
_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;
|
E_Config_Dialog_View *view;
|
||||||
|
|
||||||
if (e_config_dialog_find(_Name, "e_mixer_config_module_dialog_new"))
|
if (e_config_dialog_find(_Name, "e_mixer_config_module_dialog_new"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view = E_NEW(E_Config_Dialog_View, 1);
|
view = E_NEW(E_Config_Dialog_View, 1);
|
||||||
if (!view)
|
if (!view)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
view->create_cfdata = _create_data;
|
view->create_cfdata = _create_data;
|
||||||
view->free_cfdata = _free_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
|
typedef struct E_Mixer_Module_Config
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
const char *default_gc_id;
|
const char *default_gc_id;
|
||||||
Eina_Hash *gadgets;
|
Eina_Hash *gadgets;
|
||||||
} E_Mixer_Module_Config;
|
} E_Mixer_Module_Config;
|
||||||
|
|
||||||
typedef struct E_Mixer_Instance
|
typedef struct E_Mixer_Instance
|
||||||
|
@ -34,21 +34,21 @@ typedef struct E_Mixer_Instance
|
||||||
E_Menu *menu;
|
E_Menu *menu;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Evas_Object *gadget;
|
Evas_Object *gadget;
|
||||||
Evas_Object *label;
|
Evas_Object *label;
|
||||||
Evas_Object *left;
|
Evas_Object *left;
|
||||||
Evas_Object *right;
|
Evas_Object *right;
|
||||||
Evas_Object *mute;
|
Evas_Object *mute;
|
||||||
Evas_Object *table;
|
Evas_Object *table;
|
||||||
Evas_Object *button;
|
Evas_Object *button;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Ecore_X_Window win;
|
Ecore_X_Window win;
|
||||||
Ecore_Event_Handler *mouse_up;
|
Ecore_Event_Handler *mouse_up;
|
||||||
Ecore_Event_Handler *key_down;
|
Ecore_Event_Handler *key_down;
|
||||||
} input;
|
} input;
|
||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
E_Mixer_System *sys;
|
E_Mixer_System *sys;
|
||||||
E_Mixer_Channel *channel;
|
E_Mixer_Channel *channel;
|
||||||
|
@ -66,11 +66,11 @@ typedef struct E_Mixer_Module_Context
|
||||||
Eina_List *instances;
|
Eina_List *instances;
|
||||||
E_Dialog *mixer_dialog;
|
E_Dialog *mixer_dialog;
|
||||||
struct st_mixer_actions
|
struct st_mixer_actions
|
||||||
{
|
{
|
||||||
E_Action *incr;
|
E_Action *incr;
|
||||||
E_Action *decr;
|
E_Action *decr;
|
||||||
E_Action *mute;
|
E_Action *mute;
|
||||||
} actions;
|
} actions;
|
||||||
} E_Mixer_Module_Context;
|
} E_Mixer_Module_Context;
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
|
@ -8,9 +8,9 @@ typedef void E_Mixer_Channel;
|
||||||
|
|
||||||
struct E_Mixer_Channel_State
|
struct E_Mixer_Channel_State
|
||||||
{
|
{
|
||||||
int mute;
|
int mute;
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
};
|
};
|
||||||
typedef struct E_Mixer_Channel_State E_Mixer_Channel_State;
|
typedef struct E_Mixer_Channel_State E_Mixer_Channel_State;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ _cb_dispatch(void *data)
|
||||||
desc->idler = NULL;
|
desc->idler = NULL;
|
||||||
|
|
||||||
if (!r)
|
if (!r)
|
||||||
_mixer_callback_del(desc->self, desc); /* desc is invalid then. */
|
_mixer_callback_del(desc->self, desc); /* desc is invalid then. */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -45,25 +45,25 @@ _cb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
desc = data;
|
desc = data;
|
||||||
|
|
||||||
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
|
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
|
||||||
{
|
{
|
||||||
desc->handlers = eina_list_remove(desc->handlers, fd_handler);
|
desc->handlers = eina_list_remove(desc->handlers, fd_handler);
|
||||||
if (!desc->handlers)
|
if (!desc->handlers)
|
||||||
{
|
{
|
||||||
E_Mixer_System *s;
|
E_Mixer_System *s;
|
||||||
int (*f)(void *, E_Mixer_System *);
|
int (*f)(void *, E_Mixer_System *);
|
||||||
void *d;
|
void *d;
|
||||||
|
|
||||||
s = desc->self;
|
s = desc->self;
|
||||||
f = desc->func;
|
f = desc->func;
|
||||||
d = desc->data;
|
d = desc->data;
|
||||||
_mixer_callback_del(s, desc);
|
_mixer_callback_del(s, desc);
|
||||||
_mixer_callback_add(s, f, d);
|
_mixer_callback_add(s, f, d);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!desc->idler)
|
if (!desc->idler)
|
||||||
desc->idler = ecore_idler_add(_cb_dispatch, desc);
|
desc->idler = ecore_idler_add(_cb_dispatch, desc);
|
||||||
return 1;
|
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);
|
len = snd_mixer_poll_descriptors_count(self);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
desc = malloc(sizeof(struct e_mixer_callback_desc));
|
desc = malloc(sizeof(struct e_mixer_callback_desc));
|
||||||
if (!desc)
|
if (!desc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
desc->func = func;
|
desc->func = func;
|
||||||
desc->data = data;
|
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));
|
pfds = alloca(len * sizeof(struct pollfd));
|
||||||
len = snd_mixer_poll_descriptors(self, pfds, len);
|
len = snd_mixer_poll_descriptors(self, pfds, len);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
free(desc);
|
free(desc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
Ecore_Fd_Handler *fd_handler;
|
Ecore_Fd_Handler *fd_handler;
|
||||||
|
|
||||||
len--;
|
len--;
|
||||||
fd_handler = ecore_main_fd_handler_add(
|
fd_handler = ecore_main_fd_handler_add(
|
||||||
pfds[len].fd, ECORE_FD_READ, _cb_fd_handler, desc, NULL, NULL);
|
pfds[len].fd, ECORE_FD_READ, _cb_fd_handler, desc, NULL, NULL);
|
||||||
desc->handlers = eina_list_prepend(desc->handlers, fd_handler);
|
desc->handlers = eina_list_prepend(desc->handlers, fd_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_mixer_set_callback_private(self, desc);
|
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);
|
snd_mixer_set_callback_private(self, NULL);
|
||||||
|
|
||||||
EINA_LIST_FREE(desc->handlers, handler)
|
EINA_LIST_FREE(desc->handlers, handler)
|
||||||
ecore_main_fd_handler_del(handler);
|
ecore_main_fd_handler_del(handler);
|
||||||
|
|
||||||
free(desc);
|
free(desc);
|
||||||
|
|
||||||
|
@ -142,29 +142,29 @@ e_mixer_system_new(const char *name)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
err = snd_mixer_open(&handle, 0);
|
err = snd_mixer_open(&handle, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error_open;
|
goto error_open;
|
||||||
|
|
||||||
err = snd_mixer_attach(handle, name);
|
err = snd_mixer_attach(handle, name);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error_load;
|
goto error_load;
|
||||||
|
|
||||||
err = snd_mixer_selem_register(handle, NULL, NULL);
|
err = snd_mixer_selem_register(handle, NULL, NULL);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error_load;
|
goto error_load;
|
||||||
|
|
||||||
err = snd_mixer_load(handle);
|
err = snd_mixer_load(handle);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error_load;
|
goto error_load;
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
|
|
||||||
error_load:
|
error_load:
|
||||||
snd_mixer_close(handle);
|
snd_mixer_close(handle);
|
||||||
error_open:
|
error_open:
|
||||||
fprintf(stderr, "MIXER: Cannot get hardware info: %s\n", snd_strerror(err));
|
fprintf(stderr, "MIXER: Cannot get hardware info: %s\n", snd_strerror(err));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -175,11 +175,11 @@ e_mixer_system_del(E_Mixer_System *self)
|
||||||
struct e_mixer_callback_desc *desc;
|
struct e_mixer_callback_desc *desc;
|
||||||
|
|
||||||
if (self <= 0)
|
if (self <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
desc = snd_mixer_get_callback_private(self);
|
desc = snd_mixer_get_callback_private(self);
|
||||||
if (desc)
|
if (desc)
|
||||||
_mixer_callback_del(self, desc);
|
_mixer_callback_del(self, desc);
|
||||||
|
|
||||||
snd_mixer_close(self);
|
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;
|
struct e_mixer_callback_desc *desc;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
desc = snd_mixer_get_callback_private(self);
|
desc = snd_mixer_get_callback_private(self);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
{
|
{
|
||||||
if (func)
|
if (func)
|
||||||
return _mixer_callback_add(self, func, data);
|
return _mixer_callback_add(self, func, data);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (func)
|
if (func)
|
||||||
return _mixer_callback_replace(self, desc, func, data);
|
return _mixer_callback_replace(self, desc, func, data);
|
||||||
else
|
else
|
||||||
return _mixer_callback_del(self, desc);
|
return _mixer_callback_del(self, desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
|
@ -217,21 +217,21 @@ e_mixer_system_get_cards(void)
|
||||||
cards = NULL;
|
cards = NULL;
|
||||||
card_num = -1;
|
card_num = -1;
|
||||||
while (((err = snd_card_next(&card_num)) == 0) && (card_num >= 0))
|
while (((err = snd_card_next(&card_num)) == 0) && (card_num >= 0))
|
||||||
{
|
{
|
||||||
snd_ctl_t *control;
|
snd_ctl_t *control;
|
||||||
char buf[256];
|
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)
|
if (snd_ctl_open(&control, buf, 0) < 0)
|
||||||
break;
|
break;
|
||||||
snd_ctl_close(control);
|
snd_ctl_close(control);
|
||||||
cards = eina_list_append(cards, eina_stringshare_add(buf));
|
cards = eina_list_append(cards, eina_stringshare_add(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
fprintf(stderr, "MIXER: Cannot get available card number: %s\n",
|
fprintf(stderr, "MIXER: Cannot get available card number: %s\n",
|
||||||
snd_strerror(err));
|
snd_strerror(err));
|
||||||
|
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ e_mixer_system_free_cards(Eina_List *cards)
|
||||||
const char *card;
|
const char *card;
|
||||||
|
|
||||||
EINA_LIST_FREE(cards, card)
|
EINA_LIST_FREE(cards, card)
|
||||||
eina_stringshare_del(card);
|
eina_stringshare_del(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -252,7 +252,7 @@ e_mixer_system_get_default_card(void)
|
||||||
snd_ctl_t *control;
|
snd_ctl_t *control;
|
||||||
|
|
||||||
if (snd_ctl_open(&control, buf, 0) < 0)
|
if (snd_ctl_open(&control, buf, 0) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
snd_ctl_close(control);
|
snd_ctl_close(control);
|
||||||
return eina_stringshare_add(buf);
|
return eina_stringshare_add(buf);
|
||||||
}
|
}
|
||||||
|
@ -266,30 +266,30 @@ e_mixer_system_get_card_name(const char *card)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!card)
|
if (!card)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snd_ctl_card_info_alloca(&hw_info);
|
snd_ctl_card_info_alloca(&hw_info);
|
||||||
|
|
||||||
err = snd_ctl_open(&control, card, 0);
|
err = snd_ctl_open(&control, card, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
err = snd_ctl_card_info(control, hw_info);
|
err = snd_ctl_card_info(control, hw_info);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "MIXER: Cannot get hardware info: %s: %s\n", card,
|
fprintf(stderr, "MIXER: Cannot get hardware info: %s: %s\n", card,
|
||||||
snd_strerror(err));
|
snd_strerror(err));
|
||||||
snd_ctl_close(control);
|
snd_ctl_close(control);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_ctl_close(control);
|
snd_ctl_close(control);
|
||||||
name = snd_ctl_card_info_get_name(hw_info);
|
name = snd_ctl_card_info_get_name(hw_info);
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "MIXER: Cannot get hardware name: %s\n", card);
|
fprintf(stderr, "MIXER: Cannot get hardware name: %s\n", card);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return eina_stringshare_add(name);
|
return eina_stringshare_add(name);
|
||||||
}
|
}
|
||||||
|
@ -301,19 +301,19 @@ e_mixer_system_get_channels(E_Mixer_System *self)
|
||||||
snd_mixer_elem_t *elem;
|
snd_mixer_elem_t *elem;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
channels = NULL;
|
channels = NULL;
|
||||||
|
|
||||||
elem = snd_mixer_first_elem(self);
|
elem = snd_mixer_first_elem(self);
|
||||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||||
{
|
{
|
||||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
channels = eina_list_append(channels, elem);
|
channels = eina_list_append(channels, elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return channels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
@ -332,24 +332,24 @@ e_mixer_system_get_channels_names(E_Mixer_System *self)
|
||||||
snd_mixer_selem_id_t *sid;
|
snd_mixer_selem_id_t *sid;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
channels = NULL;
|
channels = NULL;
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
|
|
||||||
elem = snd_mixer_first_elem(self);
|
elem = snd_mixer_first_elem(self);
|
||||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snd_mixer_selem_get_id(elem, sid);
|
snd_mixer_selem_get_id(elem, sid);
|
||||||
name = snd_mixer_selem_id_get_name(sid);
|
name = snd_mixer_selem_id_get_name(sid);
|
||||||
if (name)
|
if (name)
|
||||||
channels = eina_list_append(channels, eina_stringshare_add(name));
|
channels = eina_list_append(channels, eina_stringshare_add(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return channels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ e_mixer_system_free_channels_names(Eina_List *channels_names)
|
||||||
const char *channel;
|
const char *channel;
|
||||||
|
|
||||||
EINA_LIST_FREE(channels_names, channel)
|
EINA_LIST_FREE(channels_names, channel)
|
||||||
eina_stringshare_del(channel);
|
eina_stringshare_del(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -370,23 +370,23 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
|
||||||
snd_mixer_selem_id_t *sid;
|
snd_mixer_selem_id_t *sid;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
|
|
||||||
elem = snd_mixer_first_elem(self);
|
elem = snd_mixer_first_elem(self);
|
||||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snd_mixer_selem_get_id(elem, sid);
|
snd_mixer_selem_get_id(elem, sid);
|
||||||
name = snd_mixer_selem_id_get_name(sid);
|
name = snd_mixer_selem_id_get_name(sid);
|
||||||
if (name)
|
if (name)
|
||||||
return eina_stringshare_add(name);
|
return eina_stringshare_add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
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;
|
snd_mixer_selem_id_t *sid;
|
||||||
|
|
||||||
if ((!self) || (!name))
|
if ((!self) || (!name))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
|
|
||||||
elem = snd_mixer_first_elem(self);
|
elem = snd_mixer_first_elem(self);
|
||||||
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
|
||||||
{
|
{
|
||||||
const char *n;
|
const char *n;
|
||||||
if ((!snd_mixer_selem_is_active(elem)) ||
|
if ((!snd_mixer_selem_is_active(elem)) ||
|
||||||
(!snd_mixer_selem_has_playback_volume(elem)))
|
(!snd_mixer_selem_has_playback_volume(elem)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snd_mixer_selem_get_id(elem, sid);
|
snd_mixer_selem_get_id(elem, sid);
|
||||||
n = snd_mixer_selem_id_get_name(sid);
|
n = snd_mixer_selem_id_get_name(sid);
|
||||||
if (n && (strcmp(n, name) == 0))
|
if (n && (strcmp(n, name) == 0))
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if ((!self) || (!channel))
|
if ((!self) || (!channel))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
snd_mixer_selem_get_id(channel, 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;
|
long lvol, rvol, range, min, max;
|
||||||
|
|
||||||
if ((!self) || (!channel) || (!left) || (!right))
|
if ((!self) || (!channel) || (!left) || (!right))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_mixer_handle_events(self);
|
snd_mixer_handle_events(self);
|
||||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||||
range = max - min;
|
range = max - min;
|
||||||
if (range < 1)
|
if (range < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (snd_mixer_selem_has_playback_channel(channel, 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
|
else
|
||||||
lvol = min;
|
lvol = min;
|
||||||
|
|
||||||
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
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
|
else
|
||||||
rvol = min;
|
rvol = min;
|
||||||
|
|
||||||
if (snd_mixer_selem_is_playback_mono(channel) ||
|
if (snd_mixer_selem_is_playback_mono(channel) ||
|
||||||
snd_mixer_selem_has_playback_volume_joined(channel))
|
snd_mixer_selem_has_playback_volume_joined(channel))
|
||||||
rvol = lvol;
|
rvol = lvol;
|
||||||
|
|
||||||
*left = rint((double)(lvol - min) * 100 / (double)range);
|
*left = rint((double)(lvol - min) * 100 / (double)range);
|
||||||
*right = rint((double)(rvol - 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;
|
int mode;
|
||||||
|
|
||||||
if ((!self) || (!channel))
|
if ((!self) || (!channel))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_mixer_handle_events(self);
|
snd_mixer_handle_events(self);
|
||||||
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
snd_mixer_selem_get_playback_volume_range(channel, &min, &max);
|
||||||
div = 100 + min;
|
div = 100 + min;
|
||||||
if (div == 0)
|
if (div == 0)
|
||||||
{
|
{
|
||||||
div = 1; /* no zero-division */
|
div = 1; /* no zero-division */
|
||||||
min++;
|
min++;
|
||||||
}
|
}
|
||||||
|
|
||||||
range = max - min;
|
range = max - min;
|
||||||
if (range < 1)
|
if (range < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (left >= 0)
|
if (left >= 0)
|
||||||
{
|
{
|
||||||
left = (((range * left) + (range / 2)) / div) - min;
|
left = (((range * left) + (range / 2)) / div) - min;
|
||||||
mode |= 1;
|
mode |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (right >= 0)
|
if (right >= 0)
|
||||||
{
|
{
|
||||||
right = (((range * right) + (range / 2)) / div) - min;
|
right = (((range * right) + (range / 2)) / div) - min;
|
||||||
mode |= 2;
|
mode |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode & 1)
|
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)) &&
|
if ((!snd_mixer_selem_is_playback_mono(channel)) &&
|
||||||
(!snd_mixer_selem_has_playback_volume_joined(channel)) &&
|
(!snd_mixer_selem_has_playback_volume_joined(channel)) &&
|
||||||
(mode & 2))
|
(mode & 2))
|
||||||
{
|
{
|
||||||
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
if (snd_mixer_selem_has_playback_channel(channel, 1))
|
||||||
snd_mixer_selem_set_playback_volume(channel, 1, right);
|
snd_mixer_selem_set_playback_volume(channel, 1, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -527,33 +527,33 @@ int
|
||||||
e_mixer_system_can_mute(E_Mixer_System *self, E_Mixer_Channel *channel)
|
e_mixer_system_can_mute(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||||
{
|
{
|
||||||
if ((!self) || (!channel))
|
if ((!self) || (!channel))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_mixer_handle_events(self);
|
snd_mixer_handle_events(self);
|
||||||
return (snd_mixer_selem_has_playback_switch(channel) ||
|
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
|
int
|
||||||
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
||||||
{
|
{
|
||||||
if ((!self) || (!channel) || (!mute))
|
if ((!self) || (!channel) || (!mute))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_mixer_handle_events(self);
|
snd_mixer_handle_events(self);
|
||||||
if (snd_mixer_selem_has_playback_switch(channel) ||
|
if (snd_mixer_selem_has_playback_switch(channel) ||
|
||||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
/* XXX: not checking for return, always returns 0 even if it worked.
|
/* XXX: not checking for return, always returns 0 even if it worked.
|
||||||
* alsamixer also don't check it. Bug?
|
* alsamixer also don't check it. Bug?
|
||||||
*/
|
*/
|
||||||
snd_mixer_selem_get_playback_switch(channel, 0, &m);
|
snd_mixer_selem_get_playback_switch(channel, 0, &m);
|
||||||
*mute = !m;
|
*mute = !m;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*mute = 0;
|
*mute = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -562,14 +562,14 @@ int
|
||||||
e_mixer_system_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int mute)
|
e_mixer_system_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int mute)
|
||||||
{
|
{
|
||||||
if ((!self) || (!channel))
|
if ((!self) || (!channel))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snd_mixer_handle_events(self);
|
snd_mixer_handle_events(self);
|
||||||
if (snd_mixer_selem_has_playback_switch(channel) ||
|
if (snd_mixer_selem_has_playback_switch(channel) ||
|
||||||
snd_mixer_selem_has_playback_switch_joined(channel))
|
snd_mixer_selem_has_playback_switch_joined(channel))
|
||||||
return snd_mixer_selem_set_playback_switch_all(channel, !mute);
|
return snd_mixer_selem_set_playback_switch_all(channel, !mute);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -578,7 +578,7 @@ e_mixer_system_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!state)
|
if (!state)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = e_mixer_system_get_mute(self, channel, &state->mute);
|
r = e_mixer_system_get_mute(self, channel, &state->mute);
|
||||||
r &= e_mixer_system_get_volume(self, channel, &state->left, &state->right);
|
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;
|
int r;
|
||||||
|
|
||||||
if (!state)
|
if (!state)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = e_mixer_system_set_mute(self, channel, state->mute);
|
r = e_mixer_system_set_mute(self, channel, state->mute);
|
||||||
r &= e_mixer_system_set_volume(self, channel, state->left, state->right);
|
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)
|
e_mixer_system_has_capture(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||||
{
|
{
|
||||||
if ((!self) || (!channel))
|
if ((!self) || (!channel))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return snd_mixer_selem_has_capture_switch(channel);
|
return snd_mixer_selem_has_capture_switch(channel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ e_mixer_system_new(const char *name)
|
||||||
_e_mixer_dummy_set();
|
_e_mixer_dummy_set();
|
||||||
|
|
||||||
if (name == _name || strcmp(name, _name) == 0)
|
if (name == _name || strcmp(name, _name) == 0)
|
||||||
return (E_Mixer_System *)-1;
|
return (E_Mixer_System *)-1;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -60,9 +60,9 @@ e_mixer_system_get_card_name(const char *card)
|
||||||
_e_mixer_dummy_set();
|
_e_mixer_dummy_set();
|
||||||
|
|
||||||
if (card == _name || strcmp(card, _name) == 0)
|
if (card == _name || strcmp(card, _name) == 0)
|
||||||
return eina_stringshare_ref(_name);
|
return eina_stringshare_ref(_name);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
|
@ -105,9 +105,9 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self, const char *name)
|
||||||
_e_mixer_dummy_set();
|
_e_mixer_dummy_set();
|
||||||
|
|
||||||
if (name == _name || strcmp(name, _name) == 0)
|
if (name == _name || strcmp(name, _name) == 0)
|
||||||
return (E_Mixer_Channel *)-2;
|
return (E_Mixer_Channel *)-2;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -119,18 +119,18 @@ const char *
|
||||||
e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||||
{
|
{
|
||||||
if (channel == (E_Mixer_Channel *)-2)
|
if (channel == (E_Mixer_Channel *)-2)
|
||||||
return eina_stringshare_ref(_name);
|
return eina_stringshare_ref(_name);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
e_mixer_system_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right)
|
e_mixer_system_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *left, int *right)
|
||||||
{
|
{
|
||||||
if (left)
|
if (left)
|
||||||
*left = 0;
|
*left = 0;
|
||||||
if (right)
|
if (right)
|
||||||
*right = 0;
|
*right = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ int
|
||||||
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int *mute)
|
||||||
{
|
{
|
||||||
if (mute)
|
if (mute)
|
||||||
*mute = 1;
|
*mute = 1;
|
||||||
|
|
||||||
return 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};
|
const E_Mixer_Channel_State def = {1, 0, 0};
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
*state = def;
|
*state = def;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue