scons --> make
[aftubes.git] / sound-ioctl.c
blobded299865cf120a82575481aab360d264e1959ab
1 /* Easier writing these bits in C rather
2 than defining the ioctls in D */
4 #include "fcntl.h"
5 #include "sys/ioctl.h"
6 #include "linux/soundcard.h"
8 int sound_set_format(int fd, int format)
10 int tmp;
11 tmp = format;
12 if (ioctl(fd, SNDCTL_DSP_SETFMT, &tmp) == -1
13 || tmp != format)
15 return -1;
16 } else {
17 return 0;
21 int sound_set_srate(int fd, int srate)
23 int tmp;
24 tmp = srate;
25 if (ioctl(fd, SNDCTL_DSP_SPEED, &tmp) == -1
26 || tmp != srate)
28 return -1;
29 } else {
30 return 0;
34 int sound_set_channels(int fd, int channels)
36 int tmp;
37 tmp = channels;
38 if (ioctl(fd, SNDCTL_DSP_CHANNELS, &tmp) == -1
39 || tmp != channels)
41 return -1;
42 } else {
43 return 0;