diff --git a/src/modules/mixer/app_mixer.c b/src/modules/mixer/app_mixer.c index af7aef17c..e87211bc5 100644 --- a/src/modules/mixer/app_mixer.c +++ b/src/modules/mixer/app_mixer.c @@ -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; diff --git a/src/modules/mixer/conf_gadget.c b/src/modules/mixer/conf_gadget.c index e2a751fb1..9c93b00ea 100644 --- a/src/modules/mixer/conf_gadget.c +++ b/src/modules/mixer/conf_gadget.c @@ -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; diff --git a/src/modules/mixer/conf_module.c b/src/modules/mixer/conf_module.c index a3e494c87..4df8d5b9a 100644 --- a/src/modules/mixer/conf_module.c +++ b/src/modules/mixer/conf_module.c @@ -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; diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index 4799e9c43..06cf72c54 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -16,7 +16,7 @@ e_mixer_theme_path(void) dirlen = strlen(mixer_mod->dir); if (dirlen >= sizeof(tmpbuf) - sizeof(TF)) - return NULL; + return NULL; memcpy(tmpbuf, mixer_mod->dir, dirlen); memcpy(tmpbuf + dirlen, TF, sizeof(TF)); @@ -33,23 +33,23 @@ _mixer_gadget_configuration_defaults(E_Mixer_Gadget_Config *conf) card = e_mixer_system_get_default_card(); if (!card) - return 0; + return 0; sys = e_mixer_system_new(card); if (!sys) - { - eina_stringshare_del(card); - return 0; - } + { + eina_stringshare_del(card); + return 0; + } channel = e_mixer_system_get_default_channel_name(sys); e_mixer_system_del(sys); if (!channel) - { - eina_stringshare_del(card); - return 0; - } + { + eina_stringshare_del(card); + return 0; + } conf->card = card; conf->channel_name = channel; @@ -66,17 +66,17 @@ _mixer_gadget_configuration_new(E_Mixer_Module_Config *mod_conf, const char *id) conf = E_NEW(E_Mixer_Gadget_Config, 1); if (!conf) - return NULL; + return NULL; if (!_mixer_gadget_configuration_defaults(conf)) - { - E_FREE(conf); - return NULL; - } + { + E_FREE(conf); + return NULL; + } conf->id = eina_stringshare_add(id); if (!mod_conf->gadgets) - mod_conf->gadgets = eina_hash_string_superfast_new(NULL); + mod_conf->gadgets = eina_hash_string_superfast_new(NULL); eina_hash_direct_add(mod_conf->gadgets, conf->id, conf); return conf; @@ -86,12 +86,12 @@ static inline void _mixer_gadget_configuration_free_int(E_Mixer_Gadget_Config *conf) { if (conf->dialog) - e_object_del(E_OBJECT(conf->dialog)); + e_object_del(E_OBJECT(conf->dialog)); if (conf->card) - eina_stringshare_del(conf->card); + eina_stringshare_del(conf->card); if (conf->channel_name) - eina_stringshare_del(conf->channel_name); + eina_stringshare_del(conf->channel_name); eina_stringshare_del(conf->id); free(conf); @@ -101,12 +101,12 @@ static void _mixer_gadget_configuration_free(E_Mixer_Module_Config *mod_conf, E_Mixer_Gadget_Config *conf) { if (!mod_conf) - return; + return; if (!conf) - return; + return; eina_hash_del(mod_conf->gadgets, conf->id, conf); if (!eina_hash_population(mod_conf->gadgets)) - eina_hash_free(mod_conf->gadgets); + eina_hash_free(mod_conf->gadgets); _mixer_gadget_configuration_free_int(conf); } @@ -131,7 +131,7 @@ _mixer_module_configuration_new(void) conf = E_NEW(E_Mixer_Module_Config, 1); if (!conf) - return NULL; + return NULL; conf->version = MOD_CONF_VERSION; @@ -142,10 +142,10 @@ static void _mixer_module_configuration_free(E_Mixer_Module_Config *conf) { if (!conf) - return; + return; eina_hash_foreach(conf->gadgets, - _mixer_gadget_configuration_free_foreach, NULL); + _mixer_gadget_configuration_free_foreach, NULL); eina_hash_free(conf->gadgets); free(conf); } @@ -158,11 +158,11 @@ _mixer_popup_update(E_Mixer_Instance *inst) state = &inst->mixer_state; if (inst->ui.left) - e_slider_value_set(inst->ui.left, state->left); + e_slider_value_set(inst->ui.left, state->left); if (inst->ui.right) - e_slider_value_set(inst->ui.right, state->right); + e_slider_value_set(inst->ui.right, state->right); if (inst->ui.mute) - e_widget_check_checked_set(inst->ui.mute, state->mute); + e_widget_check_checked_set(inst->ui.mute, state->mute); } static void @@ -171,7 +171,7 @@ _mixer_gadget_update(E_Mixer_Instance *inst) Edje_Message_Int_Set *msg; if (!inst) - return; + return; e_mixer_system_get_state(inst->sys, inst->channel, &inst->mixer_state); @@ -185,7 +185,7 @@ _mixer_gadget_update(E_Mixer_Instance *inst) edje_object_signal_emit(inst->ui.gadget, "e,action,volume,change", "e"); if (inst->popup) - _mixer_popup_update(inst); + _mixer_popup_update(inst); } static void @@ -195,24 +195,24 @@ _mixer_balance_left(E_Mixer_Instance *inst) state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); if (state->left >= 0) - { - if (state->left > 5) - state->left -= 5; - else - state->left = 0; - } + { + if (state->left > 5) + state->left -= 5; + else + state->left = 0; + } if (state->right >= 0) - { - if (state->right < 95) - state->right += 5; - else - state->right = 100; - } + { + if (state->right < 95) + state->right += 5; + else + state->right = 100; + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -223,23 +223,23 @@ _mixer_balance_right(E_Mixer_Instance *inst) state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); if (state->left >= 0) - { - if (state->left < 95) - state->left += 5; - else - state->left = 100; - } + { + if (state->left < 95) + state->left += 5; + else + state->left = 100; + } if (state->right >= 0) - { - if (state->right > 5) - state->right -= 5; - else - state->right = 0; - } + { + if (state->right > 5) + state->right -= 5; + else + state->right = 0; + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -250,25 +250,25 @@ _mixer_volume_increase(E_Mixer_Instance *inst) state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); if (state->left >= 0) - { - if (state->left < 95) - state->left += 5; - else - state->left = 100; - } + { + if (state->left < 95) + state->left += 5; + else + state->left = 100; + } if (state->right >= 0) - { - if (state->right < 95) - state->right += 5; - else - state->right = 100; - } + { + if (state->right < 95) + state->right += 5; + else + state->right = 100; + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -279,24 +279,24 @@ _mixer_volume_decrease(E_Mixer_Instance *inst) state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); if (state->left >= 0) - { - if (state->left > 5) - state->left -= 5; - else - state->left = 0; - } + { + if (state->left > 5) + state->left -= 5; + else + state->left = 0; + } if (state->right >= 0) - { - if (state->right > 5) - state->right -= 5; - else - state->right = 0; - } + { + if (state->right > 5) + state->right -= 5; + else + state->right = 0; + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -306,7 +306,7 @@ _mixer_toggle_mute(E_Mixer_Instance *inst) E_Mixer_Channel_State *state; if (!e_mixer_system_can_mute(inst->sys, inst->channel)) - return; + return; state = &inst->mixer_state; e_mixer_system_get_mute(inst->sys, inst->channel, &state->mute); @@ -323,21 +323,21 @@ _mixer_popup_cb_volume_left_change(void *data, Evas_Object *obj, void *event) inst = data; if (!inst) - return; + return; state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); state->left = (int)e_slider_value_get(obj); if (inst->conf->lock_sliders) - { - state->right = state->left; - e_slider_value_set(inst->ui.right, state->right); - } + { + state->right = state->left; + e_slider_value_set(inst->ui.right, state->right); + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -349,21 +349,21 @@ _mixer_popup_cb_volume_right_change(void *data, Evas_Object *obj, void *event) inst = data; if (!inst) - return; + return; state = &inst->mixer_state; e_mixer_system_get_volume(inst->sys, inst->channel, - &state->left, &state->right); + &state->left, &state->right); state->right = (int)e_slider_value_get(obj); if (inst->conf->lock_sliders) - { - state->left = state->right; - e_slider_value_set(inst->ui.left, state->left); - } + { + state->left = state->right; + e_slider_value_set(inst->ui.left, state->left); + } e_mixer_system_set_volume(inst->sys, inst->channel, - state->left, state->right); + state->left, state->right); _mixer_gadget_update(inst); } @@ -375,7 +375,7 @@ _mixer_popup_cb_mute_change(void *data, Evas_Object *obj, void *event) inst = data; if (!inst) - return; + return; state = &inst->mixer_state; state->mute = e_widget_check_checked_get(obj); @@ -428,7 +428,7 @@ _mixer_popup_input_window_mouse_up_cb(void *data, int type, void *event) E_Mixer_Instance *inst = data; if (ev->window != inst->ui.input.win) - return 1; + return 1; _mixer_popup_del(inst); @@ -443,20 +443,20 @@ _mixer_popup_input_window_key_down_cb(void *data, int type, void *event) const char *keysym; if (ev->window != inst->ui.input.win) - return 1; + return 1; keysym = ev->key; if (strcmp(keysym, "Escape") == 0) - _mixer_popup_del(inst); + _mixer_popup_del(inst); else if (strcmp(keysym, "Up") == 0) - _mixer_volume_increase(inst); + _mixer_volume_increase(inst); else if (strcmp(keysym, "Down") == 0) - _mixer_volume_decrease(inst); + _mixer_volume_decrease(inst); else if ((strcmp(keysym, "Return") == 0) || - (strcmp(keysym, "KP_Enter") == 0)) - _mixer_toggle_mute(inst); + (strcmp(keysym, "KP_Enter") == 0)) + _mixer_toggle_mute(inst); else - _mixer_popup_del(inst); /* XXX really? */ + _mixer_popup_del(inst); /* XXX really? */ return 1; } @@ -485,19 +485,19 @@ _mixer_popup_input_window_create(E_Mixer_Instance *inst) w = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h); mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE | - ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); popup_w = inst->popup->win->evas_win; ecore_x_window_configure(w, mask, 0, 0, 0, 0, 0, popup_w, - ECORE_X_WINDOW_STACK_BELOW); + ECORE_X_WINDOW_STACK_BELOW); ecore_x_window_show(w); inst->ui.input.mouse_up = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _mixer_popup_input_window_mouse_up_cb, inst); + ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, + _mixer_popup_input_window_mouse_up_cb, inst); inst->ui.input.key_down = - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _mixer_popup_input_window_key_down_cb, inst); + ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + _mixer_popup_input_window_key_down_cb, inst); inst->ui.input.win = w; } @@ -536,15 +536,15 @@ _mixer_popup_cb_mixer(void *data, void *data2) ctxt = mixer_mod->data; if (ctxt->mixer_dialog) - { - _mixer_app_select_current(ctxt->mixer_dialog, inst); - e_dialog_show(ctxt->mixer_dialog); - return; - } + { + _mixer_app_select_current(ctxt->mixer_dialog, inst); + 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, _mixer_app_cb_del, ctxt); + con, _mixer_app_cb_del, ctxt); _mixer_app_select_current(ctxt->mixer_dialog, inst); } @@ -557,16 +557,16 @@ _mixer_popup_new(E_Mixer_Instance *inst) int colspan; if (inst->conf->dialog) - return; + return; state = &inst->mixer_state; e_mixer_system_get_state(inst->sys, inst->channel, state); if ((state->right >= 0) && - (inst->conf->show_locked || (!inst->conf->lock_sliders))) - colspan = 2; + (inst->conf->show_locked || (!inst->conf->lock_sliders))) + colspan = 2; else - colspan = 1; + colspan = 1; inst->popup = e_gadcon_popup_new(inst->gcc, _mixer_popup_cb_resize); evas = inst->popup->win->evas; @@ -578,40 +578,40 @@ _mixer_popup_new(E_Mixer_Instance *inst) 0, 0, colspan, 1, 0, 0, 0, 0); if (state->left >= 0) - { - inst->ui.left = _mixer_popup_add_slider( - inst, state->left, _mixer_popup_cb_volume_left_change); - e_widget_table_object_append(inst->ui.table, inst->ui.left, - 0, 1, 1, 1, 1, 1, 1, 1); - } + { + inst->ui.left = _mixer_popup_add_slider( + inst, state->left, _mixer_popup_cb_volume_left_change); + e_widget_table_object_append(inst->ui.table, inst->ui.left, + 0, 1, 1, 1, 1, 1, 1, 1); + } else - inst->ui.left = NULL; + inst->ui.left = NULL; if ((state->right >= 0) && - (inst->conf->show_locked || (!inst->conf->lock_sliders))) - { - inst->ui.right = _mixer_popup_add_slider( - inst, state->right, _mixer_popup_cb_volume_right_change); - e_widget_table_object_append(inst->ui.table, inst->ui.right, - 1, 1, 1, 1, 1, 1, 1, 1); - } + (inst->conf->show_locked || (!inst->conf->lock_sliders))) + { + inst->ui.right = _mixer_popup_add_slider( + inst, state->right, _mixer_popup_cb_volume_right_change); + e_widget_table_object_append(inst->ui.table, inst->ui.right, + 1, 1, 1, 1, 1, 1, 1, 1); + } else - inst->ui.right = NULL; + inst->ui.right = NULL; if (e_mixer_system_can_mute(inst->sys, inst->channel)) - { - inst->ui.mute = e_widget_check_add(evas, _("Mute"), &state->mute); - evas_object_show(inst->ui.mute); - e_widget_table_object_append(inst->ui.table, inst->ui.mute, - 0, 2, colspan, 1, 1, 1, 1, 0); - evas_object_smart_callback_add(inst->ui.mute, "changed", - _mixer_popup_cb_mute_change, inst); - } + { + inst->ui.mute = e_widget_check_add(evas, _("Mute"), &state->mute); + evas_object_show(inst->ui.mute); + e_widget_table_object_append(inst->ui.table, inst->ui.mute, + 0, 2, colspan, 1, 1, 1, 1, 0); + evas_object_smart_callback_add(inst->ui.mute, "changed", + _mixer_popup_cb_mute_change, inst); + } else - inst->ui.mute = NULL; + inst->ui.mute = NULL; inst->ui.button = e_widget_button_add(evas, _("Controls"), NULL, - _mixer_popup_cb_mixer, inst, NULL); + _mixer_popup_cb_mixer, inst, NULL); e_widget_table_object_append(inst->ui.table, inst->ui.button, 0, 7, colspan, 1, 1, 1, 1, 0); @@ -627,12 +627,12 @@ _mixer_menu_cb_post(void *data, E_Menu *menu) inst = data; if ((!inst) || (!inst->menu)) - return; + return; if (inst->menu) - { - e_object_del(E_OBJECT(inst->menu)); - inst->menu = NULL; - } + { + e_object_del(E_OBJECT(inst->menu)); + inst->menu = NULL; + } } static void @@ -643,9 +643,9 @@ _mixer_menu_cb_cfg(void *data, E_Menu *menu, E_Menu_Item *mi) inst = data; if (!inst) - return; + return; if (inst->popup) - _mixer_popup_del(inst); + _mixer_popup_del(inst); con = e_container_current_get(e_manager_current_get()); inst->conf->dialog = e_mixer_config_dialog_new(con, inst->conf); } @@ -672,9 +672,9 @@ _mixer_menu_new(E_Mixer_Instance *inst, Evas_Event_Mouse_Down *ev) e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL); e_menu_activate_mouse(mn, zone, x + ev->output.x, y + ev->output.y, - 1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp); + 1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp); evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + EVAS_BUTTON_NONE, ev->timestamp, NULL); } static void @@ -685,20 +685,20 @@ _mixer_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event) inst = data; if (!inst) - return; + return; ev = event; if (ev->button == 1) - { - if (!inst->popup) - _mixer_popup_new(inst); - else - _mixer_popup_del(inst); - } + { + if (!inst->popup) + _mixer_popup_new(inst); + else + _mixer_popup_del(inst); + } else if (ev->button == 2) - _mixer_toggle_mute(inst); + _mixer_toggle_mute(inst); else if ((ev->button == 3) && (!inst->menu)) - _mixer_menu_new(inst, ev); + _mixer_menu_new(inst, ev); } static void @@ -709,23 +709,23 @@ _mixer_cb_mouse_wheel(void *data, Evas *evas, Evas_Object *obj, void *event) inst = data; if (!inst) - return; + return; ev = event; if (ev->direction == 0) - { - if (ev->z > 0) - _mixer_volume_decrease(inst); - else if (ev->z < 0) - _mixer_volume_increase(inst); - } + { + if (ev->z > 0) + _mixer_volume_decrease(inst); + else if (ev->z < 0) + _mixer_volume_increase(inst); + } else if (ev->direction == 1) - { - if (ev->z > 0) - _mixer_balance_left(inst); - else if (ev->z < 0) - _mixer_balance_right(inst); - } + { + if (ev->z > 0) + _mixer_balance_left(inst); + else if (ev->z < 0) + _mixer_balance_right(inst); + } } static int @@ -736,17 +736,17 @@ _mixer_sys_setup(E_Mixer_Instance *inst) conf = inst->conf; if (inst->sys) - e_mixer_system_del(inst->sys); + e_mixer_system_del(inst->sys); inst->sys = e_mixer_system_new(conf->card); if (!inst->sys) - { - inst->channel = NULL; - return 0; - } + { + inst->channel = NULL; + return 0; + } inst->channel = e_mixer_system_get_channel_by_name(inst->sys, - conf->channel_name); + conf->channel_name); return inst->channel != NULL; } @@ -769,11 +769,11 @@ e_mixer_update(E_Mixer_Instance *inst) e_modapi_save(mixer_mod); if ((!inst) || (!inst->conf)) - return 0; + return 0; r = _mixer_sys_setup(inst); if (r) - e_mixer_system_callback_set(inst->sys, _mixer_system_cb_update, inst); + e_mixer_system_callback_set(inst->sys, _mixer_system_cb_update, inst); return r; } @@ -786,23 +786,23 @@ _mixer_sys_setup_default_card(E_Mixer_Instance *inst) conf = inst->conf; if (conf->card) - eina_stringshare_del(conf->card); + eina_stringshare_del(conf->card); card = e_mixer_system_get_default_card(); if (!card) - goto error; + goto error; inst->sys = e_mixer_system_new(card); if (!inst->sys) - goto system_error; + goto system_error; conf->card = card; return 1; - system_error: +system_error: eina_stringshare_del(card); - error: +error: conf->card = NULL; return 0; } @@ -815,22 +815,22 @@ _mixer_sys_setup_default_channel(E_Mixer_Instance *inst) conf = inst->conf; if (conf->channel_name) - eina_stringshare_del(conf->channel_name); + eina_stringshare_del(conf->channel_name); channel_name = e_mixer_system_get_default_channel_name(inst->sys); if (!channel_name) - goto error; + goto error; inst->channel = e_mixer_system_get_channel_by_name(inst->sys, channel_name); if (!inst->channel) - goto system_error; + goto system_error; conf->channel_name = channel_name; return 1; - system_error: +system_error: eina_stringshare_del(channel_name); - error: +error: conf->channel_name = NULL; return 0; } @@ -839,7 +839,7 @@ static int _mixer_sys_setup_defaults(E_Mixer_Instance *inst) { if ((!inst->sys) && (!_mixer_sys_setup_default_card(inst))) - return 0; + return 0; return _mixer_sys_setup_default_channel(inst); } @@ -855,40 +855,40 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) E_Mixer_Gadget_Config *conf; if (!mixer_mod) - return NULL; + return NULL; ctxt = mixer_mod->data; if (!ctxt->conf) - { - _mixer_module_configuration_setup(ctxt); - if (!ctxt->conf) - return NULL; - } + { + _mixer_module_configuration_setup(ctxt); + if (!ctxt->conf) + return NULL; + } conf = eina_hash_find(ctxt->conf->gadgets, id); if (!conf) - { - conf = _mixer_gadget_configuration_new(ctxt->conf, id); - if (!conf) - return NULL; - } + { + conf = _mixer_gadget_configuration_new(ctxt->conf, id); + if (!conf) + return NULL; + } inst = E_NEW(E_Mixer_Instance, 1); inst->conf = conf; conf->instance = inst; if ((!_mixer_sys_setup(inst)) && (!_mixer_sys_setup_defaults(inst))) - { - if (inst->sys) - e_mixer_system_del(inst->sys); - _mixer_gadget_configuration_free(ctxt->conf, conf); - E_FREE(inst); - return NULL; - } + { + if (inst->sys) + e_mixer_system_del(inst->sys); + _mixer_gadget_configuration_free(ctxt->conf, conf); + E_FREE(inst); + return NULL; + } e_mixer_system_callback_set(inst->sys, _mixer_system_cb_update, inst); inst->ui.gadget = edje_object_add(gc->evas); e_theme_edje_object_set(inst->ui.gadget, "base/theme/modules/mixer", - "e/modules/mixer/main"); + "e/modules/mixer/main"); inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->ui.gadget); inst->gcc->data = inst; @@ -896,19 +896,19 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) evas_object_event_callback_add(inst->ui.gadget, EVAS_CALLBACK_MOUSE_DOWN, _mixer_cb_mouse_down, inst); evas_object_event_callback_add(inst->ui.gadget, EVAS_CALLBACK_MOUSE_WHEEL, - _mixer_cb_mouse_wheel, inst); + _mixer_cb_mouse_wheel, inst); e_mixer_system_get_state(inst->sys, inst->channel, &inst->mixer_state); _mixer_gadget_update(inst); if (!ctxt->conf->default_gc_id) - { - ctxt->conf->default_gc_id = eina_stringshare_add(id); - ctxt->default_instance = inst; - } + { + ctxt->conf->default_gc_id = eina_stringshare_add(id); + ctxt->default_instance = inst; + } else if ((!ctxt->default_instance) || - (strcmp(id, ctxt->conf->default_gc_id) == 0)) - ctxt->default_instance = inst; + (strcmp(id, ctxt->conf->default_gc_id) == 0)) + ctxt->default_instance = inst; ctxt->instances = eina_list_append(ctxt->instances, inst); @@ -922,21 +922,21 @@ _gc_shutdown(E_Gadcon_Client *gcc) E_Mixer_Instance *inst; if (!mixer_mod) - return; + return; ctxt = mixer_mod->data; if (!ctxt) - return; + return; inst = gcc->data; if (!inst) - return; + return; if (inst->menu) - { - e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL); - e_object_del(E_OBJECT(inst->menu)); - } + { + e_menu_post_deactivate_callback_set(inst->menu, NULL, NULL); + e_object_del(E_OBJECT(inst->menu)); + } evas_object_del(inst->ui.gadget); e_mixer_system_channel_del(inst->channel); e_mixer_system_del(inst->sys); @@ -977,11 +977,11 @@ _gc_id_new(E_Gadcon_Client_Class *client_class) Eina_List *instances; if (!mixer_mod) - return NULL; + return NULL; ctxt = mixer_mod->data; if (!ctxt) - return NULL; + return NULL; instances = ctxt->instances; snprintf(tmpbuf, sizeof(tmpbuf), "mixer.%d", eina_list_count(instances)); @@ -1005,14 +1005,14 @@ _mixer_cb_volume_increase(E_Object *obj, const char *params) E_Mixer_Module_Context *ctxt; if (!mixer_mod) - return; + return; ctxt = mixer_mod->data; if (!ctxt->conf) - return; + return; if (ctxt->default_instance) - _mixer_volume_increase(ctxt->default_instance); + _mixer_volume_increase(ctxt->default_instance); } static void @@ -1021,14 +1021,14 @@ _mixer_cb_volume_decrease(E_Object *obj, const char *params) E_Mixer_Module_Context *ctxt; if (!mixer_mod) - return; + return; ctxt = mixer_mod->data; if (!ctxt->conf) - return; + return; if (ctxt->default_instance) - _mixer_volume_decrease(ctxt->default_instance); + _mixer_volume_decrease(ctxt->default_instance); } static void @@ -1037,14 +1037,14 @@ _mixer_cb_volume_mute(E_Object *obj, const char *params) E_Mixer_Module_Context *ctxt; if (!mixer_mod) - return; + return; ctxt = mixer_mod->data; if (!ctxt->conf) - return; + return; if (ctxt->default_instance) - _mixer_toggle_mute(ctxt->default_instance); + _mixer_toggle_mute(ctxt->default_instance); } static E_Config_Dialog * @@ -1053,21 +1053,21 @@ _mixer_module_config(E_Container *con, const char *params __UNUSED__) E_Mixer_Module_Context *ctxt; if (!mixer_mod) - return NULL; + return NULL; ctxt = mixer_mod->data; if (!ctxt) - return NULL; + return NULL; if (ctxt->conf_dialog) - return NULL; + return NULL; if (!ctxt->conf) - { - _mixer_module_configuration_setup(ctxt); - if (!ctxt->conf) - return NULL; - } + { + _mixer_module_configuration_setup(ctxt); + if (!ctxt->conf) + return NULL; + } ctxt->conf_dialog = e_mixer_config_module_dialog_new(con, ctxt); return ctxt->conf_dialog; @@ -1082,8 +1082,8 @@ _mixer_configure_registry_register(void) e_configure_registry_category_add(_reg_cat, 90, _("Extensions"), NULL, "preferences-extensions"); e_configure_registry_item_add(_reg_item, 30, _(_Name), NULL, - "preferences-desktop-mixer", - _mixer_module_config); + "preferences-desktop-mixer", + _mixer_module_config); } static void @@ -1100,7 +1100,7 @@ _mixer_module_configuration_descriptor_new(E_Config_DD *gadget_conf_edd) conf_edd = E_CONFIG_DD_NEW("Mixer_Module_Config", E_Mixer_Module_Config); if (!conf_edd) - return NULL; + return NULL; E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, version, INT); E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, default_gc_id, STR); E_CONFIG_HASH(conf_edd, E_Mixer_Module_Config, gadgets, gadget_conf_edd); @@ -1112,7 +1112,7 @@ static inline void _mixer_module_configuration_descriptor_free(E_Config_DD *conf_edd) { if (!conf_edd) - return; + return; E_CONFIG_DD_FREE(conf_edd); } @@ -1123,7 +1123,7 @@ _mixer_gadget_configuration_descriptor_new(void) conf_edd = E_CONFIG_DD_NEW("Mixer_Gadget_Config", E_Mixer_Gadget_Config); if (!conf_edd) - return NULL; + return NULL; E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, lock_sliders, INT); E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, show_locked, INT); E_CONFIG_VAL(conf_edd, E_Mixer_Gadget_Config, card, STR); @@ -1136,7 +1136,7 @@ static inline void _mixer_gadget_configuration_descriptor_free(E_Config_DD *conf_edd) { if (!conf_edd) - return; + return; E_CONFIG_DD_FREE(conf_edd); } @@ -1147,21 +1147,21 @@ _mixer_module_configuration_load(E_Config_DD *module_conf_edd) conf = e_config_domain_load(_conf_domain, module_conf_edd); if (!conf) - return _mixer_module_configuration_new(); + return _mixer_module_configuration_new(); if (conf->version != MOD_CONF_VERSION) - { - _mixer_module_configuration_free(conf); - conf = _mixer_module_configuration_new(); - if (!conf) - return NULL; + { + _mixer_module_configuration_free(conf); + conf = _mixer_module_configuration_new(); + if (!conf) + return NULL; - ecore_timer_add(1.0, _mixer_module_configuration_alert, - _("Mixer Module Settings data changed.
" - "Your old configuration has been replaced with " - "new default.
Sorry for the inconvenience.")); - return conf; - } + ecore_timer_add(1.0, _mixer_module_configuration_alert, + _("Mixer Module Settings data changed.
" + "Your old configuration has been replaced with " + "new default.
Sorry for the inconvenience.")); + return conf; + } return conf; } @@ -1190,49 +1190,49 @@ _mixer_actions_register(E_Mixer_Module_Context *ctxt) { ctxt->actions.incr = e_action_add(_act_increase); if (ctxt->actions.incr) - { - ctxt->actions.incr->func.go = _mixer_cb_volume_increase; - e_action_predef_name_set(_(_Name), _(_lbl_increase), _act_increase, - NULL, NULL, 0); - } + { + ctxt->actions.incr->func.go = _mixer_cb_volume_increase; + e_action_predef_name_set(_(_Name), _(_lbl_increase), _act_increase, + NULL, NULL, 0); + } ctxt->actions.decr = e_action_add(_act_decrease); if (ctxt->actions.decr) - { - ctxt->actions.decr->func.go = _mixer_cb_volume_decrease; - e_action_predef_name_set(_(_Name), _(_lbl_decrease), _act_decrease, - NULL, NULL, 0); - } + { + ctxt->actions.decr->func.go = _mixer_cb_volume_decrease; + e_action_predef_name_set(_(_Name), _(_lbl_decrease), _act_decrease, + NULL, NULL, 0); + } ctxt->actions.mute = e_action_add(_act_mute); if (ctxt->actions.mute) - { - ctxt->actions.mute->func.go = _mixer_cb_volume_mute; - e_action_predef_name_set(_(_Name), _(_lbl_mute), _act_mute, - NULL, NULL, 0); - } + { + ctxt->actions.mute->func.go = _mixer_cb_volume_mute; + e_action_predef_name_set(_(_Name), _(_lbl_mute), _act_mute, + NULL, NULL, 0); + } } static void _mixer_actions_unregister(E_Mixer_Module_Context *ctxt) { if (ctxt->actions.incr) - { - e_action_predef_name_del(_(_Name), _(_lbl_increase)); - e_action_del(_act_increase); - } + { + e_action_predef_name_del(_(_Name), _(_lbl_increase)); + e_action_del(_act_increase); + } if (ctxt->actions.decr) - { - e_action_predef_name_del(_(_Name), _(_lbl_decrease)); - e_action_del(_act_decrease); - } + { + e_action_predef_name_del(_(_Name), _(_lbl_decrease)); + e_action_del(_act_decrease); + } if (ctxt->actions.mute) - { - e_action_predef_name_del(_(_Name), _(_lbl_mute)); - e_action_del(_act_mute); - } + { + e_action_predef_name_del(_(_Name), _(_lbl_mute)); + e_action_del(_act_mute); + } } EAPI void * @@ -1242,7 +1242,7 @@ e_modapi_init(E_Module *m) ctxt = E_NEW(E_Mixer_Module_Context, 1); if (!ctxt) - return NULL; + return NULL; _mixer_configure_registry_register(); _mixer_actions_register(ctxt); @@ -1255,12 +1255,12 @@ static void _mixer_instances_free(E_Mixer_Module_Context *ctxt) { while (ctxt->instances) - { - E_Mixer_Instance *inst; + { + E_Mixer_Instance *inst; - inst = ctxt->instances->data; - e_object_del(E_OBJECT(inst->gcc)); - } + inst = ctxt->instances->data; + e_object_del(E_OBJECT(inst->gcc)); + } } EAPI int @@ -1270,26 +1270,26 @@ e_modapi_shutdown(E_Module *m) ctxt = m->data; if (!ctxt) - return 0; + return 0; _mixer_instances_free(ctxt); if (ctxt->conf_dialog) - e_object_del(E_OBJECT(ctxt->conf_dialog)); + e_object_del(E_OBJECT(ctxt->conf_dialog)); if (ctxt->mixer_dialog) - e_object_del(E_OBJECT(ctxt->mixer_dialog)); + e_object_del(E_OBJECT(ctxt->mixer_dialog)); _mixer_configure_registry_unregister(); _mixer_actions_unregister(ctxt); e_gadcon_provider_unregister(&_gc_class); if (ctxt->conf) - { - _mixer_module_configuration_free(ctxt->conf); - _mixer_gadget_configuration_descriptor_free(ctxt->gadget_conf_edd); - _mixer_module_configuration_descriptor_free(ctxt->module_conf_edd); - } + { + _mixer_module_configuration_free(ctxt->conf); + _mixer_gadget_configuration_descriptor_free(ctxt->gadget_conf_edd); + _mixer_module_configuration_descriptor_free(ctxt->module_conf_edd); + } E_FREE(ctxt); mixer_mod = NULL; @@ -1303,9 +1303,9 @@ e_modapi_save(E_Module *m) ctxt = m->data; if (!ctxt) - return 0; + return 0; if (!ctxt->conf) - return 1; + return 1; return e_config_domain_save(_conf_domain, ctxt->module_conf_edd, ctxt->conf); } diff --git a/src/modules/mixer/e_mod_main.h b/src/modules/mixer/e_mod_main.h index 150e0054a..dc7034041 100644 --- a/src/modules/mixer/e_mod_main.h +++ b/src/modules/mixer/e_mod_main.h @@ -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; diff --git a/src/modules/mixer/e_mod_system.h b/src/modules/mixer/e_mod_system.h index 3286d0b54..89bccade6 100644 --- a/src/modules/mixer/e_mod_system.h +++ b/src/modules/mixer/e_mod_system.h @@ -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; diff --git a/src/modules/mixer/sys_alsa.c b/src/modules/mixer/sys_alsa.c index 41699d15a..19066a328 100644 --- a/src/modules/mixer/sys_alsa.c +++ b/src/modules/mixer/sys_alsa.c @@ -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); } diff --git a/src/modules/mixer/sys_dummy.c b/src/modules/mixer/sys_dummy.c index 866132bd3..a9427974e 100644 --- a/src/modules/mixer/sys_dummy.c +++ b/src/modules/mixer/sys_dummy.c @@ -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; }