scons --> make
[aftubes.git] / soundout.c
blob74f9595c3be5666634a277c325fae8047afc6a90
1 #include "sound-ioctl.h"
2 #include "soundout.h"
3 #include "unistd.h"
4 #include "fcntl.h"
6 int soundout_open(struct soundout *so, const struct aformat *af)
8 so->fd = open("/dev/dsp", O_WRONLY);
9 if (so->fd < 0){
10 return 1;
13 if (sound_set_format(so->fd, 16)){
14 return 1;
17 if (sound_set_srate(so->fd, af->srate)){
18 return 1;
21 if (sound_set_channels(so->fd, af->channels)){
22 return 1;
25 return 0;
28 int soundout_write(struct soundout *so, const void *buf, size_t len)
30 write(so->fd, buf, len);
31 return 0;