static char *mixer_name[] = {MIXER_NAMES};
DECLARE_MIXER_INITS;
static struct mixer supported_mixer[] = {MIXER_ARRAY};
+#define FOR_EACH_MIXER(i) for ((i) = 0; (i) < NUM_SUPPORTED_MIXERS; (i)++)
__printf_2_3 void date_log(__a_unused int ll, const char *fmt, ...)
{
{
int i;
- for (i = 0; i < NUM_SUPPORTED_MIXERS; i++) {
+ FOR_EACH_MIXER(i) {
struct mixer *m = &supported_mixer[i];
PARA_DEBUG_LOG("initializing mixer API #%d (%s)\n",
i, mixer_name[i]);
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);
+}
+
int main(int argc, char *argv[])
{
int ret;
&conf, ¶ms);
}
init_mixers();
- m = &supported_mixer[DEFAULT_MIXER];
- PARA_INFO_LOG("using %s mixer\n", mixer_name[DEFAULT_MIXER]);
+ m = get_mixer_or_die();
ret = m->open(conf.mixer_device_arg, &h);
if (ret < 0)
goto out;
string typestr = "filename"
optional
+option "mixer-api" a
+#~~~~~~~~~~~~~~~~~~~
+"choose the mixer API"
+ string typestr = "api"
+ optional
+ details = "
+ ALSA is preferred over OSS if both APIs are supported
+ and this option is not given. To see the supported
+ mixer APIs, use this option with an invalid string
+ as the mixer API, e.g. --mixer-api help.
+ "
+
option "mixer-device" m
#~~~~~~~~~~~~~~~~~~~~~~
"choose mixer device"