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); }