1 /* test_streams - Simple test pattern generator
2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 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.
26 #if defined _MSC_VER || defined __MINGW32__
31 #include "FLAC/assert.h"
32 #include "FLAC/ordinals.h"
35 /* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
36 #define M_PI 3.14159265358979323846
39 #if defined _WIN32 || defined __EMX__
40 static const char *mode = "wb";
42 static const char *mode = "w";
45 static FLAC__bool is_big_endian_host;
48 static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
52 fputc(x >> 8, f) != EOF
56 static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x)
58 return write_little_endian_uint16(f, (FLAC__uint16)x);
61 static FLAC__bool write_little_endian_uint24(FILE *f, FLAC__uint32 x)
65 fputc(x >> 8, f) != EOF &&
66 fputc(x >> 16, f) != EOF
70 static FLAC__bool write_little_endian_int24(FILE *f, FLAC__int32 x)
72 return write_little_endian_uint24(f, (FLAC__uint32)x);
75 static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
79 fputc(x >> 8, f) != EOF &&
80 fputc(x >> 16, f) != EOF &&
81 fputc(x >> 24, f) != EOF
86 /* @@@ not used (yet) */
87 static FLAC__bool write_little_endian_int32(FILE *f, FLAC__int32 x)
89 return write_little_endian_uint32(f, (FLAC__uint32)x);
93 static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 x)
96 fputc(x >> 8, f) != EOF &&
102 /* @@@ not used (yet) */
103 static FLAC__bool write_big_endian_int16(FILE *f, FLAC__int16 x)
105 return write_big_endian_uint16(f, (FLAC__uint16)x);
110 /* @@@ not used (yet) */
111 static FLAC__bool write_big_endian_uint24(FILE *f, FLAC__uint32 x)
114 fputc(x >> 16, f) != EOF &&
115 fputc(x >> 8, f) != EOF &&
122 /* @@@ not used (yet) */
123 static FLAC__bool write_big_endian_int24(FILE *f, FLAC__int32 x)
125 return write_big_endian_uint24(f, (FLAC__uint32)x);
129 static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 x)
132 fputc(x >> 24, f) != EOF &&
133 fputc(x >> 16, f) != EOF &&
134 fputc(x >> 8, f) != EOF &&
140 /* @@@ not used (yet) */
141 static FLAC__bool write_big_endian_int32(FILE *f, FLAC__int32 x)
143 return write_big_endian_uint32(f, (FLAC__uint32)x);
147 static FLAC__bool write_sane_extended(FILE *f, unsigned val)
148 /* Write to 'f' a SANE extended representation of 'val'. Return false if
149 * the write succeeds; return true otherwise.
151 * SANE extended is an 80-bit IEEE-754 representation with sign bit, 15 bits
152 * of exponent, and 64 bits of significand (mantissa). Unlike most IEEE-754
153 * representations, it does not imply a 1 above the MSB of the significand.
159 unsigned int shift, exponent;
161 FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */
163 for(shift= 0U; (val>>(31-shift))==0U; ++shift)
166 exponent= 63U-(shift+32U); /* add 32 for unused second word */
168 if(!write_big_endian_uint16(f, (FLAC__uint16)(exponent+0x3FFF)))
170 if(!write_big_endian_uint32(f, val))
172 if(!write_big_endian_uint32(f, 0)) /* unused second word */
178 /* a mono one-sample 16bps stream */
179 static FLAC__bool generate_01()
182 FLAC__int16 x = -32768;
184 if(0 == (f = fopen("test01.raw", mode)))
187 if(!write_little_endian_int16(f, x))
197 /* a stereo one-sample 16bps stream */
198 static FLAC__bool generate_02()
201 FLAC__int16 xl = -32768, xr = 32767;
203 if(0 == (f = fopen("test02.raw", mode)))
206 if(!write_little_endian_int16(f, xl))
208 if(!write_little_endian_int16(f, xr))
218 /* a mono five-sample 16bps stream */
219 static FLAC__bool generate_03()
222 FLAC__int16 x[] = { -25, 0, 25, 50, 100 };
225 if(0 == (f = fopen("test03.raw", mode)))
228 for(i = 0; i < 5; i++)
229 if(!write_little_endian_int16(f, x[i]))
239 /* a stereo five-sample 16bps stream */
240 static FLAC__bool generate_04()
243 FLAC__int16 x[] = { -25, 500, 0, 400, 25, 300, 50, 200, 100, 100 };
246 if(0 == (f = fopen("test04.raw", mode)))
249 for(i = 0; i < 10; i++)
250 if(!write_little_endian_int16(f, x[i]))
260 /* a mono full-scale deflection 8bps stream */
261 static FLAC__bool generate_fsd8(const char *fn, const int pattern[], unsigned reps)
266 FLAC__ASSERT(pattern != 0);
268 if(0 == (f = fopen(fn, mode)))
271 for(rep = 0; rep < reps; rep++) {
272 for(p = 0; pattern[p]; p++) {
273 signed char x = pattern[p] > 0? 127 : -128;
274 if(fwrite(&x, sizeof(x), 1, f) < 1)
286 /* a mono full-scale deflection 16bps stream */
287 static FLAC__bool generate_fsd16(const char *fn, const int pattern[], unsigned reps)
292 FLAC__ASSERT(pattern != 0);
294 if(0 == (f = fopen(fn, mode)))
297 for(rep = 0; rep < reps; rep++) {
298 for(p = 0; pattern[p]; p++) {
299 FLAC__int16 x = pattern[p] > 0? 32767 : -32768;
300 if(!write_little_endian_int16(f, x))
312 /* a stereo wasted-bits-per-sample 16bps stream */
313 static FLAC__bool generate_wbps16(const char *fn, unsigned samples)
318 if(0 == (f = fopen(fn, mode)))
321 for(sample = 0; sample < samples; sample++) {
322 FLAC__int16 l = (sample % 2000) << 2;
323 FLAC__int16 r = (sample % 1000) << 3;
324 if(!write_little_endian_int16(f, l))
326 if(!write_little_endian_int16(f, r))
337 /* a mono full-scale deflection 24bps stream */
338 static FLAC__bool generate_fsd24(const char *fn, const int pattern[], unsigned reps)
343 FLAC__ASSERT(pattern != 0);
345 if(0 == (f = fopen(fn, mode)))
348 for(rep = 0; rep < reps; rep++) {
349 for(p = 0; pattern[p]; p++) {
350 FLAC__int32 x = pattern[p] > 0? 8388607 : -8388608;
351 if(!write_little_endian_int24(f, x))
363 /* a mono sine-wave 8bps stream */
364 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)
366 const FLAC__int8 full_scale = 127;
367 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
368 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
370 double theta1, theta2;
373 if(0 == (f = fopen(fn, mode)))
376 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
377 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
378 FLAC__int8 v = (FLAC__int8)(val + 0.5);
379 if(fwrite(&v, sizeof(v), 1, f) < 1)
390 /* a stereo sine-wave 8bps stream */
391 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)
393 const FLAC__int8 full_scale = 127;
394 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
395 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
397 double theta1, theta2;
400 if(0 == (f = fopen(fn, mode)))
403 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
404 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
405 FLAC__int8 v = (FLAC__int8)(val + 0.5);
406 if(fwrite(&v, sizeof(v), 1, f) < 1)
408 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
409 v = (FLAC__int8)(val + 0.5);
410 if(fwrite(&v, sizeof(v), 1, f) < 1)
421 /* a mono sine-wave 16bps stream */
422 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)
424 const FLAC__int16 full_scale = 32767;
425 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
426 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
428 double theta1, theta2;
431 if(0 == (f = fopen(fn, mode)))
434 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
435 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
436 FLAC__int16 v = (FLAC__int16)(val + 0.5);
437 if(!write_little_endian_int16(f, v))
448 /* a stereo sine-wave 16bps stream */
449 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)
451 const FLAC__int16 full_scale = 32767;
452 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
453 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
455 double theta1, theta2;
458 if(0 == (f = fopen(fn, mode)))
461 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
462 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
463 FLAC__int16 v = (FLAC__int16)(val + 0.5);
464 if(!write_little_endian_int16(f, v))
466 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
467 v = (FLAC__int16)(val + 0.5);
468 if(!write_little_endian_int16(f, v))
479 /* a mono sine-wave 24bps stream */
480 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)
482 const FLAC__int32 full_scale = 0x7fffff;
483 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
484 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
486 double theta1, theta2;
489 if(0 == (f = fopen(fn, mode)))
492 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
493 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
494 FLAC__int32 v = (FLAC__int32)(val + 0.5);
495 if(!write_little_endian_int24(f, v))
506 /* a stereo sine-wave 24bps stream */
507 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)
509 const FLAC__int32 full_scale = 0x7fffff;
510 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
511 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
513 double theta1, theta2;
516 if(0 == (f = fopen(fn, mode)))
519 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
520 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
521 FLAC__int32 v = (FLAC__int32)(val + 0.5);
522 if(!write_little_endian_int24(f, v))
524 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
525 v = (FLAC__int32)(val + 0.5);
526 if(!write_little_endian_int24(f, v))
537 static FLAC__bool generate_noise(const char *fn, unsigned bytes)
541 #if !defined _MSC_VER && !defined __MINGW32__
544 if(gettimeofday(&tv, 0) < 0) {
545 fprintf(stderr, "WARNING: couldn't seed RNG with time\n");
553 if(0 == (f = fopen(fn, mode)))
556 for(b = 0; b < bytes; b++) {
557 #if !defined _MSC_VER && !defined __MINGW32__
558 FLAC__byte x = (FLAC__byte)(((unsigned)random()) & 0xff);
560 FLAC__byte x = (FLAC__byte)(((unsigned)rand()) & 0xff);
562 if(fwrite(&x, sizeof(x), 1, f) < 1)
573 static FLAC__bool generate_aiff(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
575 const unsigned true_size = channels * bytes_per_sample * samples;
576 const unsigned padded_size = (true_size + 1) & (~1u);
580 if(0 == (f = fopen(filename, mode)))
582 if(fwrite("FORM", 1, 4, f) < 4)
584 if(!write_big_endian_uint32(f, padded_size + 46))
586 if(fwrite("AIFFCOMM\000\000\000\022", 1, 12, f) < 12)
588 if(!write_big_endian_uint16(f, (FLAC__uint16)channels))
590 if(!write_big_endian_uint32(f, samples))
592 if(!write_big_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
594 if(!write_sane_extended(f, sample_rate))
596 if(fwrite("SSND", 1, 4, f) < 4)
598 if(!write_big_endian_uint32(f, true_size + 8))
600 if(fwrite("\000\000\000\000\000\000\000\000", 1, 8, f) < 8)
603 for(i = 0; i < true_size; i++)
604 if(fputc(i, f) == EOF)
606 for( ; i < padded_size; i++)
607 if(fputc(0, f) == EOF)
617 static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
619 const unsigned true_size = channels * bytes_per_sample * samples;
620 const unsigned padded_size = (true_size + 1) & (~1u);
624 if(0 == (f = fopen(filename, mode)))
626 if(fwrite("RIFF", 1, 4, f) < 4)
628 if(!write_little_endian_uint32(f, padded_size + 36))
630 if(fwrite("WAVEfmt \020\000\000\000\001\000", 1, 14, f) < 14)
632 if(!write_little_endian_uint16(f, (FLAC__uint16)channels))
634 if(!write_little_endian_uint32(f, sample_rate))
636 if(!write_little_endian_uint32(f, sample_rate * channels * bytes_per_sample))
638 if(!write_little_endian_uint16(f, (FLAC__uint16)(channels * bytes_per_sample))) /* block align */
640 if(!write_little_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
642 if(fwrite("data", 1, 4, f) < 4)
644 if(!write_little_endian_uint32(f, true_size))
647 for(i = 0; i < true_size; i++)
648 if(fputc(i, f) == EOF)
650 for( ; i < padded_size; i++)
651 if(fputc(0, f) == EOF)
661 static FLAC__bool generate_wackywavs()
665 'R', 'I', 'F', 'F', 76, 0, 0, 0,
666 'W', 'A', 'V', 'E', 'f', 'a', 'c', 't',
667 4, 0, 0, 0 , 'b', 'l', 'a', 'h',
668 'p', 'a', 'd', ' ', 4, 0, 0, 0,
669 'B', 'L', 'A', 'H', 'f', 'm', 't', ' ',
670 16, 0, 0, 0, 1, 0, 1, 0,
671 0x44,0xAC, 0, 0, 0, 0, 0, 0,
672 2, 0, 16, 0, 'd', 'a', 't', 'a',
673 16, 0, 0, 0, 0, 0, 1, 0,
674 4, 0, 9, 0, 16, 0, 25, 0,
675 36, 0, 49, 0, 'p', 'a', 'd', ' ',
676 4, 0, 0, 0, 'b', 'l', 'a', 'h'
679 if(0 == (f = fopen("wacky1.wav", mode)))
681 if(fwrite(wav, 1, 84, f) < 84)
686 if(0 == (f = fopen("wacky2.wav", mode)))
688 if(fwrite(wav, 1, 96, f) < 96)
698 int main(int argc, char *argv[])
700 FLAC__uint32 test = 1;
703 int pattern01[] = { 1, -1, 0 };
704 int pattern02[] = { 1, 1, -1, 0 };
705 int pattern03[] = { 1, -1, -1, 0 };
706 int pattern04[] = { 1, -1, 1, -1, 0 };
707 int pattern05[] = { 1, -1, -1, 1, 0 };
708 int pattern06[] = { 1, -1, 1, 1, -1, 0 };
709 int pattern07[] = { 1, -1, -1, 1, -1, 0 };
713 is_big_endian_host = (*((FLAC__byte*)(&test)))? false : true;
715 if(!generate_01()) return 1;
716 if(!generate_02()) return 1;
717 if(!generate_03()) return 1;
718 if(!generate_04()) return 1;
720 if(!generate_fsd8("fsd8-01.raw", pattern01, 100)) return 1;
721 if(!generate_fsd8("fsd8-02.raw", pattern02, 100)) return 1;
722 if(!generate_fsd8("fsd8-03.raw", pattern03, 100)) return 1;
723 if(!generate_fsd8("fsd8-04.raw", pattern04, 100)) return 1;
724 if(!generate_fsd8("fsd8-05.raw", pattern05, 100)) return 1;
725 if(!generate_fsd8("fsd8-06.raw", pattern06, 100)) return 1;
726 if(!generate_fsd8("fsd8-07.raw", pattern07, 100)) return 1;
728 if(!generate_fsd16("fsd16-01.raw", pattern01, 100)) return 1;
729 if(!generate_fsd16("fsd16-02.raw", pattern02, 100)) return 1;
730 if(!generate_fsd16("fsd16-03.raw", pattern03, 100)) return 1;
731 if(!generate_fsd16("fsd16-04.raw", pattern04, 100)) return 1;
732 if(!generate_fsd16("fsd16-05.raw", pattern05, 100)) return 1;
733 if(!generate_fsd16("fsd16-06.raw", pattern06, 100)) return 1;
734 if(!generate_fsd16("fsd16-07.raw", pattern07, 100)) return 1;
736 if(!generate_fsd24("fsd24-01.raw", pattern01, 100)) return 1;
737 if(!generate_fsd24("fsd24-02.raw", pattern02, 100)) return 1;
738 if(!generate_fsd24("fsd24-03.raw", pattern03, 100)) return 1;
739 if(!generate_fsd24("fsd24-04.raw", pattern04, 100)) return 1;
740 if(!generate_fsd24("fsd24-05.raw", pattern05, 100)) return 1;
741 if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1;
742 if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1;
744 if(!generate_wbps16("wbps16-01.raw", 1000)) return 1;
746 if(!generate_sine8_1("sine8-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
747 if(!generate_sine8_1("sine8-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
748 if(!generate_sine8_1("sine8-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
749 if(!generate_sine8_1("sine8-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
750 if(!generate_sine8_1("sine8-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
752 if(!generate_sine8_2("sine8-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
753 if(!generate_sine8_2("sine8-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
754 if(!generate_sine8_2("sine8-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
755 if(!generate_sine8_2("sine8-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
756 if(!generate_sine8_2("sine8-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
757 if(!generate_sine8_2("sine8-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
758 if(!generate_sine8_2("sine8-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
759 if(!generate_sine8_2("sine8-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
760 if(!generate_sine8_2("sine8-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
761 if(!generate_sine8_2("sine8-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
763 if(!generate_sine16_1("sine16-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
764 if(!generate_sine16_1("sine16-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
765 if(!generate_sine16_1("sine16-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
766 if(!generate_sine16_1("sine16-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
767 if(!generate_sine16_1("sine16-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
769 if(!generate_sine16_2("sine16-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
770 if(!generate_sine16_2("sine16-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
771 if(!generate_sine16_2("sine16-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
772 if(!generate_sine16_2("sine16-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
773 if(!generate_sine16_2("sine16-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
774 if(!generate_sine16_2("sine16-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
775 if(!generate_sine16_2("sine16-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
776 if(!generate_sine16_2("sine16-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
777 if(!generate_sine16_2("sine16-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
778 if(!generate_sine16_2("sine16-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
780 if(!generate_sine24_1("sine24-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
781 if(!generate_sine24_1("sine24-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
782 if(!generate_sine24_1("sine24-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
783 if(!generate_sine24_1("sine24-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
784 if(!generate_sine24_1("sine24-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
786 if(!generate_sine24_2("sine24-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
787 if(!generate_sine24_2("sine24-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
788 if(!generate_sine24_2("sine24-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
789 if(!generate_sine24_2("sine24-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
790 if(!generate_sine24_2("sine24-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
791 if(!generate_sine24_2("sine24-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
792 if(!generate_sine24_2("sine24-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
793 if(!generate_sine24_2("sine24-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
794 if(!generate_sine24_2("sine24-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
795 if(!generate_sine24_2("sine24-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
797 /* WATCHOUT: the size of noise.raw is hardcoded into test/test_flac.sh */
798 if(!generate_noise("noise.raw", 65536 * 8 * 3)) return 1;
799 if(!generate_noise("noise8m32.raw", 32)) return 1;
800 if(!generate_wackywavs()) return 1;
801 for(channels = 1; channels <= 8; channels++) {
802 unsigned bytes_per_sample;
803 for(bytes_per_sample = 1; bytes_per_sample <= 3; bytes_per_sample++) {
804 static const unsigned nsamples[] = { 1, 111, 5555 } ;
806 for(samples = 0; samples < sizeof(nsamples)/sizeof(nsamples[0]); samples++) {
809 sprintf(fn, "rt-%u-%u-%u.aiff", channels, bytes_per_sample, nsamples[samples]);
810 if(!generate_aiff(fn, 44100, channels, bytes_per_sample, nsamples[samples]))
813 sprintf(fn, "rt-%u-%u-%u.raw", channels, bytes_per_sample, nsamples[samples]);
814 if(!generate_noise(fn, channels * bytes_per_sample * nsamples[samples]))
817 sprintf(fn, "rt-%u-%u-%u.wav", channels, bytes_per_sample, nsamples[samples]);
818 if(!generate_wav(fn, 44100, channels, bytes_per_sample, nsamples[samples]))