1 /* test_streams - Simple test pattern generator
2 * Copyright (C) 2000,2001,2002,2003,2004,2005 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__
27 #include "FLAC/assert.h"
28 #include "FLAC/ordinals.h"
31 /* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
32 #define M_PI 3.14159265358979323846
36 static const char *mode = "wb";
38 static const char *mode = "w";
41 static FLAC__bool is_big_endian_host;
44 static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
48 fputc(x >> 8, f) != EOF
52 static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x)
54 return write_little_endian_uint16(f, (FLAC__uint16)x);
57 static FLAC__bool write_little_endian_uint24(FILE *f, FLAC__uint32 x)
61 fputc(x >> 8, f) != EOF &&
62 fputc(x >> 16, f) != EOF
66 static FLAC__bool write_little_endian_int24(FILE *f, FLAC__int32 x)
68 return write_little_endian_uint24(f, (FLAC__uint32)x);
71 static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
75 fputc(x >> 8, f) != EOF &&
76 fputc(x >> 16, f) != EOF &&
77 fputc(x >> 24, f) != EOF
82 /* @@@ not used (yet) */
83 static FLAC__bool write_little_endian_int32(FILE *f, FLAC__int32 x)
85 return write_little_endian_uint32(f, (FLAC__uint32)x);
89 static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 x)
92 fputc(x >> 8, f) != EOF &&
98 /* @@@ not used (yet) */
99 static FLAC__bool write_big_endian_int16(FILE *f, FLAC__int16 x)
101 return write_big_endian_uint16(f, (FLAC__uint16)x);
106 /* @@@ not used (yet) */
107 static FLAC__bool write_big_endian_uint24(FILE *f, FLAC__uint32 x)
110 fputc(x >> 16, f) != EOF &&
111 fputc(x >> 8, f) != EOF &&
118 /* @@@ not used (yet) */
119 static FLAC__bool write_big_endian_int24(FILE *f, FLAC__int32 x)
121 return write_big_endian_uint24(f, (FLAC__uint32)x);
125 static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 x)
128 fputc(x >> 24, f) != EOF &&
129 fputc(x >> 16, f) != EOF &&
130 fputc(x >> 8, f) != EOF &&
136 /* @@@ not used (yet) */
137 static FLAC__bool write_big_endian_int32(FILE *f, FLAC__int32 x)
139 return write_big_endian_uint32(f, (FLAC__uint32)x);
143 static FLAC__bool write_sane_extended(FILE *f, unsigned val)
144 /* Write to 'f' a SANE extended representation of 'val'. Return false if
145 * the write succeeds; return true otherwise.
147 * SANE extended is an 80-bit IEEE-754 representation with sign bit, 15 bits
148 * of exponent, and 64 bits of significand (mantissa). Unlike most IEEE-754
149 * representations, it does not imply a 1 above the MSB of the significand.
155 unsigned int shift, exponent;
157 FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */
159 for(shift= 0U; (val>>(31-shift))==0U; ++shift)
162 exponent= 63U-(shift+32U); /* add 32 for unused second word */
164 if(!write_big_endian_uint16(f, (FLAC__uint16)(exponent+0x3FFF)))
166 if(!write_big_endian_uint32(f, val))
168 if(!write_big_endian_uint32(f, 0)) /* unused second word */
174 /* a mono one-sample 16bps stream */
175 static FLAC__bool generate_01()
178 FLAC__int16 x = -32768;
180 if(0 == (f = fopen("test01.raw", mode)))
183 if(!write_little_endian_int16(f, x))
193 /* a stereo one-sample 16bps stream */
194 static FLAC__bool generate_02()
197 FLAC__int16 xl = -32768, xr = 32767;
199 if(0 == (f = fopen("test02.raw", mode)))
202 if(!write_little_endian_int16(f, xl))
204 if(!write_little_endian_int16(f, xr))
214 /* a mono five-sample 16bps stream */
215 static FLAC__bool generate_03()
218 FLAC__int16 x[] = { -25, 0, 25, 50, 100 };
221 if(0 == (f = fopen("test03.raw", mode)))
224 for(i = 0; i < 5; i++)
225 if(!write_little_endian_int16(f, x[i]))
235 /* a stereo five-sample 16bps stream */
236 static FLAC__bool generate_04()
239 FLAC__int16 x[] = { -25, 500, 0, 400, 25, 300, 50, 200, 100, 100 };
242 if(0 == (f = fopen("test04.raw", mode)))
245 for(i = 0; i < 10; i++)
246 if(!write_little_endian_int16(f, x[i]))
256 /* a mono full-scale deflection 8bps stream */
257 static FLAC__bool generate_fsd8(const char *fn, const int pattern[], unsigned reps)
262 FLAC__ASSERT(pattern != 0);
264 if(0 == (f = fopen(fn, mode)))
267 for(rep = 0; rep < reps; rep++) {
268 for(p = 0; pattern[p]; p++) {
269 signed char x = pattern[p] > 0? 127 : -128;
270 if(fwrite(&x, sizeof(x), 1, f) < 1)
282 /* a mono full-scale deflection 16bps stream */
283 static FLAC__bool generate_fsd16(const char *fn, const int pattern[], unsigned reps)
288 FLAC__ASSERT(pattern != 0);
290 if(0 == (f = fopen(fn, mode)))
293 for(rep = 0; rep < reps; rep++) {
294 for(p = 0; pattern[p]; p++) {
295 FLAC__int16 x = pattern[p] > 0? 32767 : -32768;
296 if(!write_little_endian_int16(f, x))
308 /* a stereo wasted-bits-per-sample 16bps stream */
309 static FLAC__bool generate_wbps16(const char *fn, unsigned samples)
314 if(0 == (f = fopen(fn, mode)))
317 for(sample = 0; sample < samples; sample++) {
318 FLAC__int16 l = (sample % 2000) << 2;
319 FLAC__int16 r = (sample % 1000) << 3;
320 if(!write_little_endian_int16(f, l))
322 if(!write_little_endian_int16(f, r))
333 /* a mono full-scale deflection 24bps stream */
334 static FLAC__bool generate_fsd24(const char *fn, const int pattern[], unsigned reps)
339 FLAC__ASSERT(pattern != 0);
341 if(0 == (f = fopen(fn, mode)))
344 for(rep = 0; rep < reps; rep++) {
345 for(p = 0; pattern[p]; p++) {
346 FLAC__int32 x = pattern[p] > 0? 8388607 : -8388608;
347 if(!write_little_endian_int24(f, x))
359 /* a mono sine-wave 8bps stream */
360 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)
362 const FLAC__int8 full_scale = 127;
363 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
364 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
366 double theta1, theta2;
369 if(0 == (f = fopen(fn, mode)))
372 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
373 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
374 FLAC__int8 v = (FLAC__int8)(val + 0.5);
375 if(fwrite(&v, sizeof(v), 1, f) < 1)
386 /* a stereo sine-wave 8bps stream */
387 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)
389 const FLAC__int8 full_scale = 127;
390 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
391 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
393 double theta1, theta2;
396 if(0 == (f = fopen(fn, mode)))
399 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
400 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
401 FLAC__int8 v = (FLAC__int8)(val + 0.5);
402 if(fwrite(&v, sizeof(v), 1, f) < 1)
404 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
405 v = (FLAC__int8)(val + 0.5);
406 if(fwrite(&v, sizeof(v), 1, f) < 1)
417 /* a mono sine-wave 16bps stream */
418 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)
420 const FLAC__int16 full_scale = 32767;
421 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
422 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
424 double theta1, theta2;
427 if(0 == (f = fopen(fn, mode)))
430 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
431 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
432 FLAC__int16 v = (FLAC__int16)(val + 0.5);
433 if(!write_little_endian_int16(f, v))
444 /* a stereo sine-wave 16bps stream */
445 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)
447 const FLAC__int16 full_scale = 32767;
448 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
449 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
451 double theta1, theta2;
454 if(0 == (f = fopen(fn, mode)))
457 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
458 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
459 FLAC__int16 v = (FLAC__int16)(val + 0.5);
460 if(!write_little_endian_int16(f, v))
462 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
463 v = (FLAC__int16)(val + 0.5);
464 if(!write_little_endian_int16(f, v))
475 /* a mono sine-wave 24bps stream */
476 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)
478 const FLAC__int32 full_scale = 0x7fffff;
479 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
480 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
482 double theta1, theta2;
485 if(0 == (f = fopen(fn, mode)))
488 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
489 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
490 FLAC__int32 v = (FLAC__int32)(val + 0.5);
491 if(!write_little_endian_int24(f, v))
502 /* a stereo sine-wave 24bps stream */
503 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)
505 const FLAC__int32 full_scale = 0x7fffff;
506 const double delta1 = 2.0 * M_PI / ( sample_rate / f1);
507 const double delta2 = 2.0 * M_PI / ( sample_rate / f2);
509 double theta1, theta2;
512 if(0 == (f = fopen(fn, mode)))
515 for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
516 double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale;
517 FLAC__int32 v = (FLAC__int32)(val + 0.5);
518 if(!write_little_endian_int24(f, v))
520 val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale;
521 v = (FLAC__int32)(val + 0.5);
522 if(!write_little_endian_int24(f, v))
533 static FLAC__bool generate_noise(const char *fn, unsigned bytes)
537 #if !defined _MSC_VER && !defined __MINGW32__
540 if(gettimeofday(&tv, 0) < 0) {
541 fprintf(stderr, "WARNING: couldn't seed RNG with time\n");
549 if(0 == (f = fopen(fn, mode)))
552 for(b = 0; b < bytes; b++) {
553 #if !defined _MSC_VER && !defined __MINGW32__
554 FLAC__byte x = (FLAC__byte)(((unsigned)random()) & 0xff);
556 FLAC__byte x = (FLAC__byte)(((unsigned)rand()) & 0xff);
558 if(fwrite(&x, sizeof(x), 1, f) < 1)
569 static FLAC__bool generate_aiff(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
571 const unsigned true_size = channels * bytes_per_sample * samples;
572 const unsigned padded_size = (true_size + 1) & (~1u);
576 if(0 == (f = fopen(filename, mode)))
578 if(fwrite("FORM", 1, 4, f) < 4)
580 if(!write_big_endian_uint32(f, padded_size + 46))
582 if(fwrite("AIFFCOMM\000\000\000\022", 1, 12, f) < 12)
584 if(!write_big_endian_uint16(f, (FLAC__uint16)channels))
586 if(!write_big_endian_uint32(f, samples))
588 if(!write_big_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
590 if(!write_sane_extended(f, sample_rate))
592 if(fwrite("SSND", 1, 4, f) < 4)
594 if(!write_big_endian_uint32(f, true_size + 8))
596 if(fwrite("\000\000\000\000\000\000\000\000", 1, 8, f) < 8)
599 for(i = 0; i < true_size; i++)
600 if(fputc(i, f) == EOF)
602 for( ; i < padded_size; i++)
603 if(fputc(0, f) == EOF)
613 static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsigned channels, unsigned bytes_per_sample, unsigned samples)
615 const unsigned true_size = channels * bytes_per_sample * samples;
616 const unsigned padded_size = (true_size + 1) & (~1u);
620 if(0 == (f = fopen(filename, mode)))
622 if(fwrite("RIFF", 1, 4, f) < 4)
624 if(!write_little_endian_uint32(f, padded_size + 36))
626 if(fwrite("WAVEfmt \020\000\000\000\001\000", 1, 14, f) < 14)
628 if(!write_little_endian_uint16(f, (FLAC__uint16)channels))
630 if(!write_little_endian_uint32(f, sample_rate))
632 if(!write_little_endian_uint32(f, sample_rate * channels * bytes_per_sample))
634 if(!write_little_endian_uint16(f, (FLAC__uint16)(channels * bytes_per_sample))) /* block align */
636 if(!write_little_endian_uint16(f, (FLAC__uint16)(8 * bytes_per_sample)))
638 if(fwrite("data", 1, 4, f) < 4)
640 if(!write_little_endian_uint32(f, true_size))
643 for(i = 0; i < true_size; i++)
644 if(fputc(i, f) == EOF)
646 for( ; i < padded_size; i++)
647 if(fputc(0, f) == EOF)
657 static FLAC__bool generate_wackywavs()
661 'R', 'I', 'F', 'F', 76, 0, 0, 0,
662 'W', 'A', 'V', 'E', 'f', 'a', 'c', 't',
663 4, 0, 0, 0 , 'b', 'l', 'a', 'h',
664 'p', 'a', 'd', ' ', 4, 0, 0, 0,
665 'B', 'L', 'A', 'H', 'f', 'm', 't', ' ',
666 16, 0, 0, 0, 1, 0, 1, 0,
667 0x44,0xAC, 0, 0, 0, 0, 0, 0,
668 2, 0, 16, 0, 'd', 'a', 't', 'a',
669 16, 0, 0, 0, 0, 0, 1, 0,
670 4, 0, 9, 0, 16, 0, 25, 0,
671 36, 0, 49, 0, 'p', 'a', 'd', ' ',
672 4, 0, 0, 0, 'b', 'l', 'a', 'h'
675 if(0 == (f = fopen("wacky1.wav", mode)))
677 if(fwrite(wav, 1, 84, f) < 84)
682 if(0 == (f = fopen("wacky2.wav", mode)))
684 if(fwrite(wav, 1, 96, f) < 96)
694 int main(int argc, char *argv[])
696 FLAC__uint32 test = 1;
699 int pattern01[] = { 1, -1, 0 };
700 int pattern02[] = { 1, 1, -1, 0 };
701 int pattern03[] = { 1, -1, -1, 0 };
702 int pattern04[] = { 1, -1, 1, -1, 0 };
703 int pattern05[] = { 1, -1, -1, 1, 0 };
704 int pattern06[] = { 1, -1, 1, 1, -1, 0 };
705 int pattern07[] = { 1, -1, -1, 1, -1, 0 };
709 is_big_endian_host = (*((FLAC__byte*)(&test)))? false : true;
711 if(!generate_01()) return 1;
712 if(!generate_02()) return 1;
713 if(!generate_03()) return 1;
714 if(!generate_04()) return 1;
716 if(!generate_fsd8("fsd8-01.raw", pattern01, 100)) return 1;
717 if(!generate_fsd8("fsd8-02.raw", pattern02, 100)) return 1;
718 if(!generate_fsd8("fsd8-03.raw", pattern03, 100)) return 1;
719 if(!generate_fsd8("fsd8-04.raw", pattern04, 100)) return 1;
720 if(!generate_fsd8("fsd8-05.raw", pattern05, 100)) return 1;
721 if(!generate_fsd8("fsd8-06.raw", pattern06, 100)) return 1;
722 if(!generate_fsd8("fsd8-07.raw", pattern07, 100)) return 1;
724 if(!generate_fsd16("fsd16-01.raw", pattern01, 100)) return 1;
725 if(!generate_fsd16("fsd16-02.raw", pattern02, 100)) return 1;
726 if(!generate_fsd16("fsd16-03.raw", pattern03, 100)) return 1;
727 if(!generate_fsd16("fsd16-04.raw", pattern04, 100)) return 1;
728 if(!generate_fsd16("fsd16-05.raw", pattern05, 100)) return 1;
729 if(!generate_fsd16("fsd16-06.raw", pattern06, 100)) return 1;
730 if(!generate_fsd16("fsd16-07.raw", pattern07, 100)) return 1;
732 if(!generate_fsd24("fsd24-01.raw", pattern01, 100)) return 1;
733 if(!generate_fsd24("fsd24-02.raw", pattern02, 100)) return 1;
734 if(!generate_fsd24("fsd24-03.raw", pattern03, 100)) return 1;
735 if(!generate_fsd24("fsd24-04.raw", pattern04, 100)) return 1;
736 if(!generate_fsd24("fsd24-05.raw", pattern05, 100)) return 1;
737 if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1;
738 if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1;
740 if(!generate_wbps16("wbps16-01.raw", 1000)) return 1;
742 if(!generate_sine8_1("sine8-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
743 if(!generate_sine8_1("sine8-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
744 if(!generate_sine8_1("sine8-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
745 if(!generate_sine8_1("sine8-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
746 if(!generate_sine8_1("sine8-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
748 if(!generate_sine8_2("sine8-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
749 if(!generate_sine8_2("sine8-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
750 if(!generate_sine8_2("sine8-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
751 if(!generate_sine8_2("sine8-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
752 if(!generate_sine8_2("sine8-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
753 if(!generate_sine8_2("sine8-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
754 if(!generate_sine8_2("sine8-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
755 if(!generate_sine8_2("sine8-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
756 if(!generate_sine8_2("sine8-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
757 if(!generate_sine8_2("sine8-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
759 if(!generate_sine16_1("sine16-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
760 if(!generate_sine16_1("sine16-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
761 if(!generate_sine16_1("sine16-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
762 if(!generate_sine16_1("sine16-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
763 if(!generate_sine16_1("sine16-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
765 if(!generate_sine16_2("sine16-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
766 if(!generate_sine16_2("sine16-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
767 if(!generate_sine16_2("sine16-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
768 if(!generate_sine16_2("sine16-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
769 if(!generate_sine16_2("sine16-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
770 if(!generate_sine16_2("sine16-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
771 if(!generate_sine16_2("sine16-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
772 if(!generate_sine16_2("sine16-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
773 if(!generate_sine16_2("sine16-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
774 if(!generate_sine16_2("sine16-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
776 if(!generate_sine24_1("sine24-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1;
777 if(!generate_sine24_1("sine24-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1;
778 if(!generate_sine24_1("sine24-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1;
779 if(!generate_sine24_1("sine24-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1;
780 if(!generate_sine24_1("sine24-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1;
782 if(!generate_sine24_2("sine24-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1;
783 if(!generate_sine24_2("sine24-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1;
784 if(!generate_sine24_2("sine24-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1;
785 if(!generate_sine24_2("sine24-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1;
786 if(!generate_sine24_2("sine24-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1;
787 if(!generate_sine24_2("sine24-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1;
788 if(!generate_sine24_2("sine24-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1;
789 if(!generate_sine24_2("sine24-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1;
790 if(!generate_sine24_2("sine24-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1;
791 if(!generate_sine24_2("sine24-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1;
793 /* WATCHOUT: the size of noise.raw is hardcoded into test/test_flac.sh */
794 if(!generate_noise("noise.raw", 65536 * 8 * 3)) return 1;
795 if(!generate_noise("noise8m32.raw", 32)) return 1;
796 if(!generate_wackywavs()) return 1;
797 for(channels = 1; channels <= 8; channels++) {
798 unsigned bytes_per_sample;
799 for(bytes_per_sample = 1; bytes_per_sample <= 3; bytes_per_sample++) {
800 static const unsigned nsamples[] = { 1, 111, 5555 } ;
802 for(samples = 0; samples < sizeof(nsamples)/sizeof(nsamples[0]); samples++) {
805 sprintf(fn, "rt-%u-%u-%u.aiff", channels, bytes_per_sample, nsamples[samples]);
806 if(!generate_aiff(fn, 44100, channels, bytes_per_sample, nsamples[samples]))
809 sprintf(fn, "rt-%u-%u-%u.raw", channels, bytes_per_sample, nsamples[samples]);
810 if(!generate_noise(fn, channels * bytes_per_sample * nsamples[samples]))
813 sprintf(fn, "rt-%u-%u-%u.wav", channels, bytes_per_sample, nsamples[samples]);
814 if(!generate_wav(fn, 44100, channels, bytes_per_sample, nsamples[samples]))