Added -s option

This commit is contained in:
Jaroslav Kysela 2001-10-15 12:36:55 +00:00
parent ff913d0143
commit e441ec8013

View file

@ -313,6 +313,7 @@ Usage: latency [OPTION]... [FILE]...
-f,--format sample format -f,--format sample format
-c,--channels channels -c,--channels channels
-r,--rate rate -r,--rate rate
-s,--seconds duration of test in seconds
"); ");
printf("Recognized sample formats are:"); printf("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) {
@ -336,6 +337,7 @@ int main(int argc, char *argv[])
{"format", 1, NULL, 'f'}, {"format", 1, NULL, 'f'},
{"channels", 1, NULL, 'c'}, {"channels", 1, NULL, 'c'},
{"rate", 1, NULL, 'r'}, {"rate", 1, NULL, 'r'},
{"seconds", 1, NULL, 's'},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
snd_pcm_t *phandle, *chandle; snd_pcm_t *phandle, *chandle;
@ -349,7 +351,7 @@ int main(int argc, char *argv[])
morehelp = 0; morehelp = 0;
while (1) { while (1) {
int c; int c;
if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:", long_option, NULL)) < 0) if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:s:", long_option, NULL)) < 0)
break; break;
switch (c) { switch (c) {
case 'h': case 'h':
@ -386,6 +388,10 @@ int main(int argc, char *argv[])
err = atoi(optarg); err = atoi(optarg);
rate = err >= 4000 && err < 200000 ? err : 44100; rate = err >= 4000 && err < 200000 ? err : 44100;
break; break;
case 's':
err = atoi(optarg);
loop_sec = err >= 1 && err <= 100000 ? err : 30;
break;
} }
} }