#include #include #include #include int main (int argc, char **argv) { const int size = 1024; CslDriver *driver; CslPcmStream *stream; CslOptions options; short buffer[size]; int i, j, fd; options.n_channels = 2; options.rate = 44100; options.pcm_format = CSL_PCM_FORMAT_S16_LE; csl_driver_init (NULL, &driver); csl_pcm_open_output (driver, "cslpcm1", options.rate, options.n_channels, options.pcm_format, &stream); fd = open("/dev/urandom", O_RDONLY); for (i = 0; i < 500; i++) { read(fd, buffer, size); for (j = 0; j < size; j++) buffer[j] = CLAMP(buffer[j], -4000, 4000); csl_pcm_write (stream, size, buffer); } csl_pcm_close (stream); csl_driver_shutdown (driver); return 0; }