Update of /cvsroot/liboss/liboss/lib
In directory usw-pr-cvs1:/tmp/cvs-serv2220
Added Files:
libosscat.c
Log Message:
Test case.
--- NEW FILE: libosscat.c ---
#include "soundcard.h"
#include <stdio.h>
/* FIXME: Add capability for recording with 'libosscat /dev/audio > somefile' */
#define BUF_SIZE 1024
#define DEVICE "/dev/dspW"
int main(int argc, char **argv)
{
int fd, play;
char buf[BUF_SIZE];
if (argc != 1) {
fprintf(stderr, "Usage: libosscat file\n");
exit(1);
}
if ((fd = open(argv[1], O_RDONLY, 0)) < 0) {
fprintf(stderr, "File %s could not be opened.", argv[1]);
exit(1);
}
if ((play = open(DEVICE, O_WRONLY, 0)) < 0) {
fprintf(stderr, "%s could not be opened.", DEVICE);
exit(1);
}
while (read(fd, buf, BUF_SIZE) > 0) {
write(play, buf, BUF_SIZE); /* if it errors, keep going */
}
return 0;
}
|