1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
--- ./src/auddev_freebsd.c.orig Sun Oct 20 14:05:07 2002
+++ ./src/auddev_freebsd.c Sun Oct 20 14:05:16 2002
@@ -45,7 +45,7 @@
#include "bat_include.h"
#ifdef FreeBSD
-#include <machine/soundcard.h>
+#include <sys/soundcard.h>
int can_read = FALSE;
int can_write = FALSE;
@@ -204,18 +204,10 @@
if (audio_fd <= 0) {
return;
}
- switch (iport) {
- case AUDIO_MICROPHONE : if (ioctl(audio_fd, MIXER_WRITE(SOUND_MIXER_MIC), &volume) == -1) {
- perror("Setting gain");
- }
- return;
- case AUDIO_LINE_IN : if (ioctl(audio_fd, MIXER_WRITE(SOUND_MIXER_LINE), &volume) == -1) {
- perror("Setting gain");
- }
- return;
+ if (ioctl(audio_fd, SOUND_MIXER_WRITE_RECLEV, &volume) == -1) {
+ perror("Setting gain");
}
- printf("ERROR: Unknown iport in audio_set_gain!\n");
- abort();
+ return;
}
int
@@ -226,17 +218,8 @@
if (audio_fd <= 0) {
return (0);
}
- switch (iport) {
- case AUDIO_MICROPHONE : if (ioctl(audio_fd, MIXER_READ(SOUND_MIXER_MIC), &volume) == -1) {
- perror("Getting gain");
- }
- break;
- case AUDIO_LINE_IN : if (ioctl(audio_fd, MIXER_READ(SOUND_MIXER_LINE), &volume) == -1) {
- perror("Getting gain");
- }
- break;
- default : printf("ERROR: Unknown iport in audio_set_gain!\n");
- abort();
+ if (ioctl(audio_fd, SOUND_MIXER_READ_RECLEV, &volume) == -1) {
+ perror("Setting gain");
}
return device_to_bat(volume & 0xff);
}
@@ -263,7 +246,7 @@
if (audio_fd <= 0) {
return (0);
}
- if (ioctl(audio_fd, MIXER_READ(SOUND_MIXER_VOLUME), &volume) == -1) {
+ if (ioctl(audio_fd, MIXER_READ(SOUND_MIXER_PCM), &volume) == -1) {
perror("Getting volume");
}
return device_to_bat(volume & 0x000000ff); /* Extract left channel volume */
|