From 4c337275d1cc0579cc8ad45b4c138287e8658f0d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 18 Aug 2010 08:22:23 +0200 Subject: speaker-test: add test pattern for PCM layer debugging purposes Signed-off-by: Jaroslav Kysela --- speaker-test/speaker-test.c | 75 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index d8d68e2..458a8d7 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -63,7 +63,8 @@ enum { TEST_PINK_NOISE = 1, TEST_SINE, - TEST_WAV + TEST_WAV, + TEST_PATTERN, }; #define MAX_CHANNELS 16 @@ -303,6 +304,71 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { } } +/* + * useful for tests + */ +static void generate_pattern(uint8_t *frames, int channel, int count, int *_pattern) { + int pattern = *_pattern; + int chn; + int8_t *samp8 = (int8_t*) frames; + int16_t *samp16 = (int16_t*) frames; + int32_t *samp32 = (int32_t*) frames; + float *samp_f = (float*) frames; + + while (count-- > 0) { + for(chn=0;chn TEST_WAV) { + if (test_type < TEST_PINK_NOISE || test_type > TEST_PATTERN) { fprintf(stderr, _("Invalid test type %s\n"), optarg); exit(1); } -- cgit v1.2.1