Simple ring modulator (silly_effect)
[aftubes.git] / soundout.c
blob038574a20def0567859d1255d17347bac6ec06d0
1 #include "sound-ioctl.h"
2 #include "soundout.h"
3 #include "unistd.h"
4 #include "fcntl.h"
6 int soundout_open(struct soundout *so, 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, af->bits)){
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, void *buf, size_t len)
30 write(so->fd, buf, len);
31 return 0;