Lines 1-4
Link Here
|
1 |
--- src/hostapi/oss/pa_unix_oss.c.orig 2018-07-17 07:24:21 UTC |
1 |
--- src/hostapi/oss/pa_unix_oss.c.orig 2016-10-30 01:23:04 UTC |
2 |
+++ src/hostapi/oss/pa_unix_oss.c |
2 |
+++ src/hostapi/oss/pa_unix_oss.c |
3 |
@@ -62,6 +62,9 @@ |
3 |
@@ -62,6 +62,9 @@ |
4 |
#include <sys/poll.h> |
4 |
#include <sys/poll.h> |
Lines 10-45
Link Here
|
10 |
|
10 |
|
11 |
#ifdef HAVE_SYS_SOUNDCARD_H |
11 |
#ifdef HAVE_SYS_SOUNDCARD_H |
12 |
# include <sys/soundcard.h> |
12 |
# include <sys/soundcard.h> |
13 |
@@ -525,7 +528,14 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta |
13 |
@@ -525,6 +528,18 @@ static PaError BuildDeviceList( PaOSSHos |
14 |
int i; |
14 |
int i; |
15 |
int numDevices = 0, maxDeviceInfos = 1; |
15 |
int numDevices = 0, maxDeviceInfos = 1; |
16 |
PaDeviceInfo **deviceInfos = NULL; |
16 |
PaDeviceInfo **deviceInfos = NULL; |
|
|
17 |
+ int basenameClone = 0; |
17 |
+ int defaultDevice = 0; |
18 |
+ int defaultDevice = 0; |
18 |
|
19 |
+ |
19 |
+#ifdef __FreeBSD__ |
20 |
+#ifdef __FreeBSD__ |
20 |
+ size_t len = sizeof(defaultDevice); |
21 |
+ size_t len; |
|
|
22 |
+ len = sizeof(basenameClone); |
23 |
+ if (sysctlbyname("hw.snd.basename_clone", &basenameClone, &len, NULL, 0) == -1 || len != 4) |
24 |
+ basenameClone = 0; |
25 |
+ len = sizeof(defaultDevice); |
21 |
+ if (sysctlbyname("hw.snd.default_unit", &defaultDevice, &len, NULL, 0) == -1 || len != 4) |
26 |
+ if (sysctlbyname("hw.snd.default_unit", &defaultDevice, &len, NULL, 0) == -1 || len != 4) |
22 |
+ defaultDevice = 0; |
27 |
+ defaultDevice = 0; |
23 |
+#endif |
28 |
+#endif |
24 |
+ |
29 |
|
25 |
/* These two will be set to the first working input and output device, respectively */ |
30 |
/* These two will be set to the first working input and output device, respectively */ |
26 |
commonApi->info.defaultInputDevice = paNoDevice; |
31 |
commonApi->info.defaultInputDevice = paNoDevice; |
27 |
commonApi->info.defaultOutputDevice = paNoDevice; |
32 |
@@ -541,7 +556,7 @@ static PaError BuildDeviceList( PaOSSHos |
28 |
@@ -541,7 +551,7 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta |
|
|
29 |
PaDeviceInfo *deviceInfo; |
33 |
PaDeviceInfo *deviceInfo; |
30 |
int testResult; |
34 |
int testResult; |
31 |
|
35 |
|
32 |
- if( i == 0 ) |
36 |
- if( i == 0 ) |
33 |
+ if( i == defaultDevice ) |
37 |
+ if( basenameClone && i == defaultDevice ) |
34 |
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE); |
38 |
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE); |
35 |
else |
39 |
else |
36 |
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i); |
40 |
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i); |
37 |
@@ -2041,5 +2051,29 @@ static signed long GetStreamWriteAvailable( PaStream* |
41 |
@@ -2043,3 +2058,27 @@ error: |
38 |
error: |
|
|
39 |
return result; |
40 |
#endif |
42 |
#endif |
41 |
+} |
43 |
} |
42 |
+ |
44 |
|
43 |
+const char *PaOSS_GetStreamInputDevice( PaStream* s ) |
45 |
+const char *PaOSS_GetStreamInputDevice( PaStream* s ) |
44 |
+{ |
46 |
+{ |
45 |
+ PaOssStream *stream = (PaOssStream*)s; |
47 |
+ PaOssStream *stream = (PaOssStream*)s; |
Lines 62-66
Link Here
|
62 |
+ } |
64 |
+ } |
63 |
+ |
65 |
+ |
64 |
+ return NULL; |
66 |
+ return NULL; |
65 |
} |
67 |
+} |
66 |
|
68 |
+ |