+static void init_mixers(void)
+{
+ int i;
+
+ FOR_EACH_MIXER(i) {
+ struct mixer *m = &supported_mixer[i];
+ PARA_DEBUG_LOG("initializing mixer API #%d (%s)\n",
+ i, mixer_name[i]);
+ m->init(m);
+ }
+}
+
+static int set_channel(struct mixer *m, struct mixer_handle *h)
+{
+ char *channels;
+ int ret;
+
+ ret = m->set_channel(h, conf.mixer_channel_arg);
+ if (ret >= 0) {
+ PARA_NOTICE_LOG("using %s mixer channel\n",
+ conf.mixer_channel_arg? conf.mixer_channel_arg
+ : "default");
+ return ret;
+ }
+ channels = m->get_channels(h);
+ printf("Available channels: %s\n", channels);
+ free(channels);
+ return ret;
+}
+
+static struct mixer *get_mixer_or_die(void)
+{
+ int i;
+
+ if (!conf.mixer_api_given)
+ i = DEFAULT_MIXER;
+ else
+ FOR_EACH_MIXER(i)
+ if (!strcmp(mixer_name[i], conf.mixer_api_arg))
+ break;
+ if (i < NUM_SUPPORTED_MIXERS) {
+ PARA_NOTICE_LOG("using %s mixer API\n", mixer_name[i]);
+ return supported_mixer + i;
+ }
+ printf("available mixer APIs: ");
+ FOR_EACH_MIXER(i) {
+ int d = (i == DEFAULT_MIXER);
+ printf("%s%s%s ", d? "[" : "", mixer_name[i], d? "]" : "");
+ }
+ printf("\n");
+ exit(EXIT_FAILURE);
+}
+
+__noreturn static void print_help_and_die(void)
+{
+ struct ggo_help h = DEFINE_GGO_HELP(fade);
+ bool d = conf.detailed_help_given;
+
+ ggo_print_help(&h, d? GPH_STANDARD_FLAGS_DETAILED : GPH_STANDARD_FLAGS);
+ exit(0);
+}
+