mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 01:06:30 +01:00
speaker-test: add -d (--debug) option to show PCM parameters
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
1247c3d8ac
commit
d18aebca5b
1 changed files with 14 additions and 1 deletions
|
@ -97,6 +97,7 @@ static snd_pcm_uframes_t buffer_size;
|
||||||
static snd_pcm_uframes_t period_size;
|
static snd_pcm_uframes_t period_size;
|
||||||
static const char *given_test_wav_file = NULL;
|
static const char *given_test_wav_file = NULL;
|
||||||
static char *wav_file_dir = SOUNDSDIR;
|
static char *wav_file_dir = SOUNDSDIR;
|
||||||
|
static int debug = 0;
|
||||||
|
|
||||||
static const char *const channel_name[MAX_CHANNELS] = {
|
static const char *const channel_name[MAX_CHANNELS] = {
|
||||||
/* 0 */ N_("Front Left"),
|
/* 0 */ N_("Front Left"),
|
||||||
|
@ -775,6 +776,7 @@ int main(int argc, char *argv[]) {
|
||||||
{"speaker", 1, NULL, 's'},
|
{"speaker", 1, NULL, 's'},
|
||||||
{"wavfile", 1, NULL, 'w'},
|
{"wavfile", 1, NULL, 'w'},
|
||||||
{"wavdir", 1, NULL, 'W'},
|
{"wavdir", 1, NULL, 'W'},
|
||||||
|
{"debug", 0, NULL, 'd'},
|
||||||
{NULL, 0, NULL, 0 },
|
{NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -793,7 +795,7 @@ int main(int argc, char *argv[]) {
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:", long_option, NULL)) < 0)
|
if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d", long_option, NULL)) < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -872,6 +874,9 @@ int main(int argc, char *argv[]) {
|
||||||
case 'W':
|
case 'W':
|
||||||
wav_file_dir = optarg;
|
wav_file_dir = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
debug = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, _("Unknown option '%c'\n"), c);
|
fprintf(stderr, _("Unknown option '%c'\n"), c);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -917,6 +922,14 @@ int main(int argc, char *argv[]) {
|
||||||
snd_pcm_close(handle);
|
snd_pcm_close(handle);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
if (debug) {
|
||||||
|
snd_output_t *log;
|
||||||
|
err = snd_output_stdio_attach(&log, stderr, 0);
|
||||||
|
if (err >= 0) {
|
||||||
|
snd_pcm_dump(handle, log);
|
||||||
|
snd_output_close(log);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
frames = malloc(snd_pcm_frames_to_bytes(handle, period_size));
|
frames = malloc(snd_pcm_frames_to_bytes(handle, period_size));
|
||||||
if (test_type == TEST_PINK_NOISE)
|
if (test_type == TEST_PINK_NOISE)
|
||||||
|
|
Loading…
Reference in a new issue