/* mixer helper function */ static int mixer_enum_string_to_value(struct mixer_ctl *ctl, const char *string) { unsigned int i; /* Search the enum strings for a particular one */ for (i = 0; i < mixer_ctl_get_num_enums(ctl); i++) { if (strcmp(mixer_ctl_get_enum_string(ctl, i), string) == 0) break; } return i; }
static void tinymix_print_enum(struct mixer_ctl *ctl) { unsigned int num_enums; unsigned int i; unsigned int value; const char *string; num_enums = mixer_ctl_get_num_enums(ctl); value = mixer_ctl_get_value(ctl, 0); for (i = 0; i < num_enums; i++) { string = mixer_ctl_get_enum_string(ctl, i); printf("%s%s, ", value == i ? "> " : "", string); } }
static void tinymix_print_enum(struct mixer_ctl *ctl, int print_all) { unsigned int num_enums; char buffer[256]; unsigned int i; num_enums = mixer_ctl_get_num_enums(ctl); for (i = 0; i < num_enums; i++) { mixer_ctl_get_enum_string(ctl, i, buffer, sizeof(buffer)); if (print_all) printf("\t%s%s", mixer_ctl_get_value(ctl, 0) == (int)i ? ">" : "", buffer); else if (mixer_ctl_get_value(ctl, 0) == (int)i) printf(" %-s", buffer); } }
static void tinymix_print_enum(struct mixer_ctl *ctl, int print_all) { unsigned int num_enums; unsigned int i; const char *string; num_enums = mixer_ctl_get_num_enums(ctl); for (i = 0; i < num_enums; i++) { string = mixer_ctl_get_enum_string(ctl, i); if (print_all) printf("\t%s%s", mixer_ctl_get_value(ctl, 0) == (int)i ? ">" : "", string); else if (mixer_ctl_get_value(ctl, 0) == (int)i) printf(" %-s", string); } }