add wasted-bits-per-sample stream

This commit is contained in:
Josh Coalson
2001-03-27 23:58:23 +00:00
parent dbe603990c
commit d041849e77
2 changed files with 34 additions and 0 deletions

View File

@@ -198,6 +198,33 @@ foo:
return false;
}
/* a stereo wasted-bits-per-sample 16bps stream */
static bool generate_wbps16(const char *fn, unsigned samples)
{
FILE *f;
unsigned sample;
if(0 == (f = fopen(fn, mode)))
return false;
for(sample = 0; sample < samples; sample++) {
int16 l = (sample % 2000) << 2;
int16 r = (sample % 1000) << 3;
swap16(&l);
swap16(&r);
if(fwrite(&l, sizeof(l), 1, f) < 1)
goto foo;
if(fwrite(&r, sizeof(r), 1, f) < 1)
goto foo;
}
fclose(f);
return true;
foo:
fclose(f);
return false;
}
/* a mono full-scale deflection 24bps stream */
static bool generate_fsd24(const char *fn, const int pattern[], unsigned reps)
{
@@ -423,6 +450,8 @@ int main(int argc, char *argv[])
if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1;
if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1;
if(!generate_wbps16("wbps16-01.raw", 1000)) return 1;
if(!generate_sine16_1("sine16-00.raw", 44100.0, 80000, 441.0, 0.50, 441.0, 0.49)) return 1;
if(!generate_sine16_1("sine16-01.raw", 44100.0, 80000, 441.0, 0.61, 661.5, 0.37)) return 1;
if(!generate_sine16_1("sine16-02.raw", 44100.0, 80000, 441.0, 0.50, 882.0, 0.49)) return 1;