Line 0
Link Here
|
|
|
1 |
--- src/hostapi/oss/pa_unix_oss.c.orig 2013-06-08 19:30:41 UTC |
2 |
+++ src/hostapi/oss/pa_unix_oss.c |
3 |
@@ -62,6 +62,9 @@ |
4 |
#include <sys/poll.h> |
5 |
#include <limits.h> |
6 |
#include <semaphore.h> |
7 |
+#ifdef __FreeBSD__ |
8 |
+#include <sys/sysctl.h> |
9 |
+#endif |
10 |
|
11 |
#ifdef HAVE_SYS_SOUNDCARD_H |
12 |
# include <sys/soundcard.h> |
13 |
@@ -525,6 +528,13 @@ static PaError BuildDeviceList( PaOSSHos |
14 |
int i; |
15 |
int numDevices = 0, maxDeviceInfos = 1; |
16 |
PaDeviceInfo **deviceInfos = NULL; |
17 |
+ int defaultDevice = 0; |
18 |
+ |
19 |
+#ifdef __FreeBSD__ |
20 |
+ size_t len = sizeof(defaultDevice); |
21 |
+ if (sysctlbyname("hw.snd.default_unit", &defaultDevice, &len, NULL, 0) == -1 || len != 4) |
22 |
+ defaultDevice = 0; |
23 |
+#endif |
24 |
|
25 |
/* These two will be set to the first working input and output device, respectively */ |
26 |
commonApi->info.defaultInputDevice = paNoDevice; |
27 |
@@ -541,7 +551,7 @@ static PaError BuildDeviceList( PaOSSHos |
28 |
PaDeviceInfo *deviceInfo; |
29 |
int testResult; |
30 |
|
31 |
- if( i == 0 ) |
32 |
+ if( i == defaultDevice ) |
33 |
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE); |
34 |
else |
35 |
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i); |