Example #1
0
int main(int argc, char **argv) {
	if (argc < 2) {
		fprintf(stderr, "Usage: %s <bits per sample>\n", argv[0]);
		exit(1);
	}
	int bits_per_sample = atoi(argv[1]);
	exit(gen_samples(bits_per_sample));
}
Example #2
0
bool 
Generator::get_chunk(Chunk &chunk)
{
  if (stream_pos >= stream_len)
    return false;

  size_t n = chunk_size;
  if (n >= stream_len - stream_pos)
    n = (size_t)(stream_len - stream_pos);
  stream_pos += n;

  if (spk.format == FORMAT_LINEAR)
  {
    gen_samples(samples, n);
    chunk.set_linear(samples, n);
    return true;
  }
  else
  {
    gen_rawdata(rawdata, n);
    chunk.set_rawdata(rawdata, n);
    return true;
  }
}