1 /* test_streams - Simple test pattern generator
2 * Copyright (C) 2000,2001,2002 Josh Coalson
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #if !defined _MSC_VER && !defined __MINGW32__
25 #include "FLAC/assert.h"
26 #include "FLAC/ordinals.h"
29 /* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
30 #define M_PI 3.14159265358979323846
34 static const char *mode = "wb";
36 static const char *mode = "w";
39 static FLAC__bool is_big_endian_host;
42 static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
46 fputc(x >> 8, f) != EOF
50 static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x)
52 return write_little_endian_uint16(f, (FLAC__uint16)x);
55 static FLAC__bool write_little_endian_uint24(FILE *f, FLAC__uint32 x)
59 fputc(x >> 8, f) != EOF &&
60 fputc(x >> 16, f) != EOF
64 static FLAC__bool write_little_endian_int24(FILE *f, FLAC__int32 x)
66 return write_little_endian_uint24(f, (FLAC__uint32)x);
69 static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
73 fputc(x >> 8, f) != EOF &&
74 fputc(x >> 16, f) != EOF &&
75 fputc(x >> 24, f) != EOF
80 /* @@@ not used (yet) */
81 static FLAC__bool write_little_endian_int32(FILE *f, FLAC__int32 x)
83 return write_little_endian_uint32(f, (FLAC__uint32)x);
87 static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 x)
90 fputc(x >> 8, f) != EOF &&
96 /* @@@ not used (yet) */
97 static FLAC__bool write_big_endian_int16(FILE *f, FLAC__int16 x)
99 return write_big_endian_uint16(f, (FLAC__uint16)x);
104 /* @@@ not used (yet) */
105 static FLAC__bool write_big_endian_uint24(FILE *f, FLAC__uint32 x)
108 fputc(x >> 16, f) != EOF &&
109 fputc(x >> 8, f) != EOF &&
116 /* @@@ not used (yet) */
117 static FLAC__bool write_big_endian_int24(FILE *f, FLAC__int32 x)
119 return write_big_endian_uint24(f, (FLAC__uint32)x);
123 static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 x)
126 fputc(x >> 24, f) != EOF &&
127 fputc(x >> 16, f) != EOF &&
128 fputc(x >> 8, f) != EOF &&
134 /* @@@ not used (yet) */
135 static FLAC__bool write_big_endian_int32(FILE *f, FLAC__int32 x)
137 return write_big_endian_uint32(f, (FLAC__uint32)x);
141 static FLAC__bool write_sane_extended(FILE *f, unsigned val)
143 unsigned i, exponent;
145 /* this reasonable limitation make the implementation simpler */
146 FLAC__ASSERT(val < 0x80000000);
148 /* we'll use the denormalized form, with no implicit '1' (i bit == 0) */
150 for(i = val, exponent = 0; i; i >>= 1, exponent++)
152 if(!write_big_endian_uint16(f, (FLAC__uint16)(exponent + 16383)))
155 for(i = 32; i; i--) {
160 if(!write_big_endian_uint32(f, val))
162 if(!write_big_endian_uint32(f, 0))
169 /* a mono one-sample 16bps stream */
170 static FLAC__bool generate_01()
173 FLAC__int16 x = -32768;
175 if(0 == (f = fopen("test01.raw", mode)))
178 if(!write_little_endian_int16(f, x))
188 /* a stereo one-sample 16bps stream */
189 static FLAC__bool generate_02()
192 FLAC__int16 xl = -32768, xr = 32767;
194 if(0 == (f = fopen("test02.raw", mode)))
197 if(!write_little_endian_int16(f, xl))
199 if(!write_little_endian_int16(f, xr))
209 /* a mono five-sample 16bps stream */
210 static FLAC__bool generate_03()
213 FLAC__int16 x[] = { -25, 0, 25, 50, 100 };
216 if(0 == (f = fopen("test03.raw", mode)))
219 for(i = 0; i < 5; i++)
220 if(!write_little_endian_int16(f, x[i]))
230 /* a stereo five-sample 16bps stream */
231 static FLAC__bool generate_04()
234 FLAC__int16 x[] = { -25, 500, 0, 400, 25, 300, 50, 200, 100, 100 };
237 if(0 == (f = fopen("test04.raw", mode)))
240 for(i = 0; i < 10; i++)
241 if(!write_little_endian_int16(f, x[i]))
251 /* a mono full-scale deflection 8bps stream */
252 static FLAC__bool generate_fsd8(const char *fn, const int pattern[], unsigned reps)
257 FLAC__ASSERT(pattern != 0);
259 if(0 == (f = fopen(fn, mode)))
262 for(rep = 0; rep < reps; rep++) {
263 for(p = 0; pattern[p]; p++) {
264 signed char x = pattern[p] > 0? 127 : -128;
265 if(fwrite(&x, sizeof(x), 1, f) < 1)
277 /* a mono full-scale deflection 16bps stream */
278 static FLAC__bool generate_fsd16(const char *fn, const int pattern[], unsigned reps)
283 FLAC__ASSERT(pattern != 0);
285 if(0 == (f = fopen(fn, mode)))
288 for(rep = 0; rep < reps; rep++) {
289 for(p = 0; pattern[p]; p++) {
290 FLAC__int16 x = pattern[p] > 0? 32767 : -32768;
291 if(!write_little_endian_int16(f, x))
303 /* a stereo wasted-bits-per-sample 16bps stream */
304 static FLAC__bool generate_wbps16(const char *fn, unsigned samples)
309 if(0 == (f = fopen(fn, mode)))
312 for(sample = 0; sample < samples; sample++) {
313 FLAC__int16 l = (sample % 2000) << 2;
314 FLAC__int16 r = (sample % 1000) << 3;
315 if(!write_little_endian_int16(f, l))
317 if(!write_little_endian_int16(f, r))
328 /* a mono full-scale deflection 24bps stream */
329 static FLAC__bool generate_fsd24(const char *fn, const int pattern[], unsigned reps)
334 FLAC__ASSERT(pattern != 0);
336 if(0 == (f = fopen(fn, mode)))
339 for(rep = 0; rep < reps; rep++) {
340 for(p = 0; pattern[p]; p++) {
341 FLAC__int32 x = pattern[p] > 0? 8388607 : -8388608;
342 if(!write_little_endian_int24(f, x))
354 /* a mono sine-wave 8bps stream */
355 static FLAC__bool generate_sine8_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2)
357 const FLAC__int8 full_scale = 127;
358 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
359 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
361 double theta1, theta2;
364 if(0 == (f = fopen(fn, mode)))
367 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
368 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
369 FLAC__int8 v = (FLAC__int8)(val + 0.5);
370 if(fwrite(&v, sizeof(v), 1, f) < 1)
381 /* a stereo sine-wave 8bps stream */
382 static FLAC__bool generate_sine8_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult)
384 const FLAC__int8 full_scale = 127;
385 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
386 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
388 double theta1, theta2;
391 if(0 == (f = fopen(fn, mode)))
394 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
395 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
396 FLAC__int8 v = (FLAC__int8)(val + 0.5);
397 if(fwrite(&v, sizeof(v), 1, f) < 1)
399 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
400 v = (FLAC__int8)(val + 0.5);
401 if(fwrite(&v, sizeof(v), 1, f) < 1)
412 /* a mono sine-wave 16bps stream */
413 static FLAC__bool generate_sine16_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2)
415 const FLAC__int16 full_scale = 32767;
416 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
417 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
419 double theta1, theta2;
422 if(0 == (f = fopen(fn, mode)))
425 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
426 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
427 FLAC__int16 v = (FLAC__int16)(val + 0.5);
428 if(!write_little_endian_int16(f, v))
439 /* a stereo sine-wave 16bps stream */
440 static FLAC__bool generate_sine16_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult)
442 const FLAC__int16 full_scale = 32767;
443 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
444 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
446 double theta1, theta2;
449 if(0 == (f = fopen(fn, mode)))
452 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
453 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
454 FLAC__int16 v = (FLAC__int16)(val + 0.5);
455 if(!write_little_endian_int16(f, v))
457 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
458 v = (FLAC__int16)(val + 0.5);
459 if(!write_little_endian_int16(f, v))
470 /* a mono sine-wave 24bps stream */
471 static FLAC__bool generate_sine24_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2)
473 const FLAC__int32 full_scale = 0x7fffff;
474 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
475 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
477 double theta1, theta2;
480 if(0 == (f = fopen(fn, mode)))
483 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
484 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
485 FLAC__int32 v = (FLAC__int32)(val + 0.5);
486 if(!write_little_endian_int24(f, v))
497 /* a stereo sine-wave 24bps stream */
498 static FLAC__bool generate_sine24_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult)
500 const FLAC__int32 full_scale = 0x7fffff;
501 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
502 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
504 double theta1, theta2;
507 if(0 == (f = fopen(fn, mode)))
510 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
511 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
512 FLAC__int32 v = (FLAC__int32)(val + 0.5);
513 if(!write_little_endian_int24(f, v))
515 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
516 v = (FLAC__int32)(val + 0.5);
517 if(!write_little_endian_int24(f, v))
528 static FLAC__bool generate_noise(const char *fn, unsigned bytes)
532 #if !defined _MSC_VER && !defined __MINGW32__
535 if(gettimeofday(&tv, 0) < 0) {
536 fprintf(stderr, "WARNING: couldn't seed RNG with time\n");
541 /* who has the patience to figure out how to do RNG with VC++? */
544 if(0 == (f = fopen(fn, mode)))
547 for(b = 0; b < bytes; b++) {
548 #if !defined _MSC_VER && !defined __MINGW32__
549 FLAC__byte x = (FLAC__byte)(((unsigned)random()) & 0xff);
551 FLAC__byte x = (FLAC__byte)((((unsigned)generate_noise) >> 8) ^ (b * 17)); /* fake it */
553 if(fwrite(&x, sizeof(x), 1, f) < 1)
564 static FLAC__bool generate_aiff(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
566 const unsigned true_size = channels * bytes_per_sample * samples;
567 const unsigned padded_size = (true_size + 1) & (~1u);
571 if(0 == (f = fopen(filename, mode)))
573 if(fwrite("FORM", 1, 4, f) < 4)
575 if(!write_big_endian_uint32(f, padded_size + 46))
577 if(fwrite("AIFFCOMM\000\000\000\022", 1, 12, f) < 12)
579 if(!write_big_endian_uint16(f, (FLAC__uint16)channels))
581 if(!write_big_endian_uint32(f, samples))
583 if(!write_big_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
585 if(!write_sane_extended(f, sample_rate))
587 if(fwrite("SSND", 1, 4, f) < 4)
589 if(!write_big_endian_uint32(f, true_size + 8))
591 if(fwrite("\000\000\000\000\000\000\000\000", 1, 8, f) < 8)
594 for(i = 0; i < true_size; i++)
595 if(fputc(i, f) == EOF)
597 for( ; i < padded_size; i++)
598 if(fputc(0, f) == EOF)
608 static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
610 const unsigned size = channels * bytes_per_sample * samples;
614 if(0 == (f = fopen(filename, mode)))
616 if(fwrite("RIFF", 1, 4, f) < 4)
618 if(!write_little_endian_uint32(f, size + 36))
620 if(fwrite("WAVEfmt \020\000\000\000\001\000", 1, 14, f) < 14)
622 if(!write_little_endian_uint16(f, (FLAC__uint16)channels))
624 if(!write_little_endian_uint32(f, sample_rate))
626 if(!write_little_endian_uint32(f, sample_rate * channels * bytes_per_sample))
628 if(!write_little_endian_uint16(f, (FLAC__uint16)(channels * bytes_per_sample))) /* block align */
630 if(!write_little_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
632 if(fwrite("data", 1, 4, f) < 4)
634 if(!write_little_endian_uint32(f, size))
637 for(i = 0; i < size; i++)
638 if(fputc(i, f) == EOF)
648 static FLAC__bool generate_wackywavs()
652 'R', 'I', 'F', 'F', 76, 0, 0, 0,
653 'W', 'A', 'V', 'E', 'f', 'a', 'c', 't',
654 4, 0, 0, 0 , 'b', 'l', 'a', 'h',
655 'p', 'a', 'd', ' ', 4, 0, 0, 0,
656 'B', 'L', 'A', 'H', 'f', 'm', 't', ' ',
657 16, 0, 0, 0, 1, 0, 1, 0,
658 0x44,0xAC, 0, 0, 0, 0, 0, 0,
659 2, 0, 16, 0, 'd', 'a', 't', 'a',
660 16, 0, 0, 0, 0, 0, 1, 0,
661 4, 0, 9, 0, 16, 0, 25, 0,
662 36, 0, 49, 0, 'p', 'a', 'd', ' ',
663 4, 0, 0, 0, 'b', 'l', 'a', 'h'
666 if(0 == (f = fopen("wacky1.wav", mode)))
668 if(fwrite(wav, 1, 84, f) < 84)
673 if(0 == (f = fopen("wacky2.wav", mode)))
675 if(fwrite(wav, 1, 96, f) < 96)
685 int main(int argc, char *argv[])
687 FLAC__uint32 test = 1;
690 int pattern01[] = { 1, -1, 0 };
691 int pattern02[] = { 1, 1, -1, 0 };
692 int pattern03[] = { 1, -1, -1, 0 };
693 int pattern04[] = { 1, -1, 1, -1, 0 };
694 int pattern05[] = { 1, -1, -1, 1, 0 };
695 int pattern06[] = { 1, -1, 1, 1, -1, 0 };
696 int pattern07[] = { 1, -1, -1, 1, -1, 0 };
700 is_big_endian_host = (*((FLAC__byte*)(&test)))? false : true;
702 if(!generate_01()) return 1;
703 if(!generate_02()) return 1;
704 if(!generate_03()) return 1;
705 if(!generate_04()) return 1;
707 if(!generate_fsd8("fsd8-01.raw", pattern01, 100)) return 1;
708 if(!generate_fsd8("fsd8-02.raw", pattern02, 100)) return 1;
709 if(!generate_fsd8("fsd8-03.raw", pattern03, 100)) return 1;
710 if(!generate_fsd8("fsd8-04.raw", pattern04, 100)) return 1;
711 if(!generate_fsd8("fsd8-05.raw", pattern05, 100)) return 1;
712 if(!generate_fsd8("fsd8-06.raw", pattern06, 100)) return 1;
713 if(!generate_fsd8("fsd8-07.raw", pattern07, 100)) return 1;
715 if(!generate_fsd16("fsd16-01.raw", pattern01, 100)) return 1;
716 if(!generate_fsd16("fsd16-02.raw", pattern02, 100)) return 1;
717 if(!generate_fsd16("fsd16-03.raw", pattern03, 100)) return 1;
718 if(!generate_fsd16("fsd16-04.raw", pattern04, 100)) return 1;
719 if(!generate_fsd16("fsd16-05.raw", pattern05, 100)) return 1;
720 if(!generate_fsd16("fsd16-06.raw", pattern06, 100)) return 1;
721 if(!generate_fsd16("fsd16-07.raw", pattern07, 100)) return 1;
723 if(!generate_fsd24("fsd24-01.raw", pattern01, 100)) return 1;
724 if(!generate_fsd24("fsd24-02.raw", pattern02, 100)) return 1;
725 if(!generate_fsd24("fsd24-03.raw", pattern03, 100)) return 1;
726 if(!generate_fsd24("fsd24-04.raw", pattern04, 100)) return 1;
727 if(!generate_fsd24("fsd24-05.raw", pattern05, 100)) return 1;
728 if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1;
729 if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1;
731 if(!generate_wbps16("wbps16-01.raw", 1000)) return 1;
733 if(!generate_sine8_1("sine8-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
734 if(!generate_sine8_1("sine8-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
735 if(!generate_sine8_1("sine8-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
736 if(!generate_sine8_1("sine8-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
737 if(!generate_sine8_1("sine8-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
739 if(!generate_sine8_2("sine8-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
740 if(!generate_sine8_2("sine8-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
741 if(!generate_sine8_2("sine8-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
742 if(!generate_sine8_2("sine8-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
743 if(!generate_sine8_2("sine8-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
744 if(!generate_sine8_2("sine8-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
745 if(!generate_sine8_2("sine8-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
746 if(!generate_sine8_2("sine8-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
747 if(!generate_sine8_2("sine8-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
748 if(!generate_sine8_2("sine8-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
750 if(!generate_sine16_1("sine16-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
751 if(!generate_sine16_1("sine16-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
752 if(!generate_sine16_1("sine16-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
753 if(!generate_sine16_1("sine16-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
754 if(!generate_sine16_1("sine16-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
756 if(!generate_sine16_2("sine16-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
757 if(!generate_sine16_2("sine16-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
758 if(!generate_sine16_2("sine16-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
759 if(!generate_sine16_2("sine16-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
760 if(!generate_sine16_2("sine16-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
761 if(!generate_sine16_2("sine16-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
762 if(!generate_sine16_2("sine16-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
763 if(!generate_sine16_2("sine16-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
764 if(!generate_sine16_2("sine16-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
765 if(!generate_sine16_2("sine16-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
767 if(!generate_sine24_1("sine24-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
768 if(!generate_sine24_1("sine24-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
769 if(!generate_sine24_1("sine24-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
770 if(!generate_sine24_1("sine24-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
771 if(!generate_sine24_1("sine24-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
773 if(!generate_sine24_2("sine24-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
774 if(!generate_sine24_2("sine24-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
775 if(!generate_sine24_2("sine24-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
776 if(!generate_sine24_2("sine24-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
777 if(!generate_sine24_2("sine24-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
778 if(!generate_sine24_2("sine24-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
779 if(!generate_sine24_2("sine24-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
780 if(!generate_sine24_2("sine24-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
781 if(!generate_sine24_2("sine24-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
782 if(!generate_sine24_2("sine24-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
784 if(!generate_noise("noise.raw", 65536 * 8 * 3)) return 1;
785 if(!generate_noise("noise8m32.raw", 32)) return 1;
786 if(!generate_wackywavs()) return 1;
787 for(channels = 1; channels <= 8; channels++) {
788 unsigned bytes_per_sample;
789 for(bytes_per_sample = 1; bytes_per_sample <= 3; bytes_per_sample++) {
790 static const unsigned nsamples[] = { 1, 111, 5555 } ;
792 for(samples = 0; samples < sizeof(nsamples)/sizeof(nsamples[0]); samples++) {
795 sprintf(fn, "rt-%u-%u-%u.aiff", channels, bytes_per_sample, nsamples[samples]);
796 if(!generate_aiff(fn, 44100, channels, bytes_per_sample, nsamples[samples]))
799 sprintf(fn, "rt-%u-%u-%u.raw", channels, bytes_per_sample, nsamples[samples]);
800 if(!generate_noise(fn, channels * bytes_per_sample * nsamples[samples]))
803 sprintf(fn, "rt-%u-%u-%u.wav", channels, bytes_per_sample, nsamples[samples]);
804 if(!generate_wav(fn, 44100, channels, bytes_per_sample, nsamples[samples]))