summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-12-15 15:27:05 +0100
committerJaroslav Kysela <perex@perex.cz>2009-12-15 15:27:05 +0100
commitd18aebca5b94e991b82382a9f30eca2d7fedbc06 (patch)
treedab949ad22ef7cb20c3fee47f0a9bb533d0b6251
parent1247c3d8ac6a3ab9b77b92de64e721948a473489 (diff)
downloadalsa-utils-d18aebca5b94e991b82382a9f30eca2d7fedbc06.tar.gz
speaker-test: add -d (--debug) option to show PCM parameters
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--speaker-test/speaker-test.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index e22c937..7859aca 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -97,6 +97,7 @@ static snd_pcm_uframes_t buffer_size;
static snd_pcm_uframes_t period_size;
static const char *given_test_wav_file = NULL;
static char *wav_file_dir = SOUNDSDIR;
+static int debug = 0;
static const char *const channel_name[MAX_CHANNELS] = {
/* 0 */ N_("Front Left"),
@@ -775,6 +776,7 @@ int main(int argc, char *argv[]) {
{"speaker", 1, NULL, 's'},
{"wavfile", 1, NULL, 'w'},
{"wavdir", 1, NULL, 'W'},
+ {"debug", 0, NULL, 'd'},
{NULL, 0, NULL, 0 },
};
@@ -793,7 +795,7 @@ int main(int argc, char *argv[]) {
while (1) {
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;
switch (c) {
@@ -872,6 +874,9 @@ int main(int argc, char *argv[]) {
case 'W':
wav_file_dir = optarg;
break;
+ case 'd':
+ debug = 1;
+ break;
default:
fprintf(stderr, _("Unknown option '%c'\n"), c);
exit(EXIT_FAILURE);
@@ -917,6 +922,14 @@ int main(int argc, char *argv[]) {
snd_pcm_close(handle);
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));
if (test_type == TEST_PINK_NOISE)