From 76abb9738e9c60dde7088879935a0361852ee897 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 17 Oct 2001 15:04:39 +0000 Subject: [PATCH] Enhanced, added -c, -r options --- test/pcm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/pcm.c b/test/pcm.c index 822127df..998a8b83 100644 --- a/test/pcm.c +++ b/test/pcm.c @@ -152,6 +152,8 @@ static void help(void) Usage: latency [OPTION]... [FILE]... -h,--help help -D,--device playback device +-r,--rate stream rate in Hz +-c,--channels count of channels in stream -f,--frequency sine wave frequency in Hz -b,--buffer ring buffer size in samples -p,--period period size in us @@ -171,6 +173,8 @@ int main(int argc, char *argv[]) { {"help", 0, NULL, 'h'}, {"device", 1, NULL, 'D'}, + {"rate", 1, NULL, 'r'}, + {"channels", 1, NULL, 'c'}, {"frequency", 1, NULL, 'f'}, {"buffer", 1, NULL, 'b'}, {"period", 1, NULL, 'p'}, @@ -193,7 +197,7 @@ int main(int argc, char *argv[]) morehelp = 0; while (1) { int c; - if ((c = getopt_long(argc, argv, "hD:f:b:p:", long_option, NULL)) < 0) + if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:", long_option, NULL)) < 0) break; switch (c) { case 'h': @@ -202,6 +206,16 @@ int main(int argc, char *argv[]) case 'D': device = strdup(optarg); break; + case 'r': + rate = atoi(optarg); + rate = rate < 4000 ? 4000 : rate; + rate = rate > 196000 ? 196000 : rate; + break; + case 'c': + channels = atoi(optarg); + channels = channels < 1 ? 1 : channels; + channels = channels > 1024 ? 1024 : channels; + break; case 'f': freq = atoi(optarg); freq = freq < 50 ? 50 : freq; -- 2.47.1