mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Enhanced, added -c, -r options
This commit is contained in:
parent
fe8ba5eb4e
commit
76abb9738e
1 changed files with 15 additions and 1 deletions
16
test/pcm.c
16
test/pcm.c
|
|
@ -152,6 +152,8 @@ static void help(void)
|
||||||
Usage: latency [OPTION]... [FILE]...
|
Usage: latency [OPTION]... [FILE]...
|
||||||
-h,--help help
|
-h,--help help
|
||||||
-D,--device playback device
|
-D,--device playback device
|
||||||
|
-r,--rate stream rate in Hz
|
||||||
|
-c,--channels count of channels in stream
|
||||||
-f,--frequency sine wave frequency in Hz
|
-f,--frequency sine wave frequency in Hz
|
||||||
-b,--buffer ring buffer size in samples
|
-b,--buffer ring buffer size in samples
|
||||||
-p,--period period size in us
|
-p,--period period size in us
|
||||||
|
|
@ -171,6 +173,8 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
{"help", 0, NULL, 'h'},
|
{"help", 0, NULL, 'h'},
|
||||||
{"device", 1, NULL, 'D'},
|
{"device", 1, NULL, 'D'},
|
||||||
|
{"rate", 1, NULL, 'r'},
|
||||||
|
{"channels", 1, NULL, 'c'},
|
||||||
{"frequency", 1, NULL, 'f'},
|
{"frequency", 1, NULL, 'f'},
|
||||||
{"buffer", 1, NULL, 'b'},
|
{"buffer", 1, NULL, 'b'},
|
||||||
{"period", 1, NULL, 'p'},
|
{"period", 1, NULL, 'p'},
|
||||||
|
|
@ -193,7 +197,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, "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;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
@ -202,6 +206,16 @@ int main(int argc, char *argv[])
|
||||||
case 'D':
|
case 'D':
|
||||||
device = strdup(optarg);
|
device = strdup(optarg);
|
||||||
break;
|
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':
|
case 'f':
|
||||||
freq = atoi(optarg);
|
freq = atoi(optarg);
|
||||||
freq = freq < 50 ? 50 : freq;
|
freq = freq < 50 ? 50 : freq;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue