diff options
author | Tobias Kortkamp <tobik@FreeBSD.org> | 2019-03-01 09:40:24 +0000 |
---|---|---|
committer | Tobias Kortkamp <tobik@FreeBSD.org> | 2019-03-01 09:40:24 +0000 |
commit | 0b561700264bfd08c8490fa20487ff0eecda9fc7 (patch) | |
tree | 91cedbb62435a07d57c1c9792f4b1e5be5035021 /audio/portaudio | |
parent | 27a22a51818b3eb3e34302b76cdc178f73c7f7a4 (diff) | |
download | ports-0b561700264bfd08c8490fa20487ff0eecda9fc7.tar.gz ports-0b561700264bfd08c8490fa20487ff0eecda9fc7.zip |
audio/portaudio: Amend r419598 and always add OSS default device first
r419598 tried to solve a problem where when hw.snd.default_unit is
set to anything except zero /dev/dsp0 is not available to programs
using portaudio since it assumes that /dev/dsp and /dev/dsp0 are
the same device.
However with that fix, when hw.snd.default_unit=1 and
hw.snd.basename_clone=0, portaudio will hide /dev/dsp1 from the
device list since it will use /dev/dsp for it instead of /dev/dsp1.
However since /dev/dsp is not available, QueryDevice() will fail
and /dev/dsp1 will never be added to the device list.
Instead of looking up hw.snd.default_unit we can solve this by
always trying to add /dev/dsp to the device list first.
PR: 236118
Submitted by: Tatsuki Makino <tatsuki_makino@hotmail.com>
Notes
Notes:
svn path=/head/; revision=494248
Diffstat (limited to 'audio/portaudio')
-rw-r--r-- | audio/portaudio/Makefile | 2 | ||||
-rw-r--r-- | audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c | 38 |
2 files changed, 11 insertions, 29 deletions
diff --git a/audio/portaudio/Makefile b/audio/portaudio/Makefile index fd21e3b7ba64..8c0d48ba6f3f 100644 --- a/audio/portaudio/Makefile +++ b/audio/portaudio/Makefile @@ -3,7 +3,7 @@ PORTNAME= portaudio PORTVERSION= 19.6.0 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 1 CATEGORIES= audio MASTER_SITES= http://www.portaudio.com/archives/ diff --git a/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c b/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c index 95629e9a9d66..04ba48af304f 100644 --- a/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c +++ b/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c @@ -1,40 +1,22 @@ ---- src/hostapi/oss/pa_unix_oss.c.orig 2018-07-17 07:24:21 UTC +--- src/hostapi/oss/pa_unix_oss.c.orig 2019-03-01 03:09:23 UTC +++ src/hostapi/oss/pa_unix_oss.c -@@ -62,6 +62,9 @@ - #include <sys/poll.h> - #include <limits.h> - #include <semaphore.h> -+#ifdef __FreeBSD__ -+#include <sys/sysctl.h> -+#endif +@@ -535,13 +535,13 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta + * add it to a linked list. + * A: Set an arbitrary of 100 devices, should probably be a smarter way. */ - #ifdef HAVE_SYS_SOUNDCARD_H - # include <sys/soundcard.h> -@@ -525,7 +528,14 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta - int i; - int numDevices = 0, maxDeviceInfos = 1; - PaDeviceInfo **deviceInfos = NULL; -+ int defaultDevice = 0; - -+#ifdef __FreeBSD__ -+ size_t len = sizeof(defaultDevice); -+ if (sysctlbyname("hw.snd.default_unit", &defaultDevice, &len, NULL, 0) == -1 || len != 4) -+ defaultDevice = 0; -+#endif -+ - /* These two will be set to the first working input and output device, respectively */ - commonApi->info.defaultInputDevice = paNoDevice; - commonApi->info.defaultOutputDevice = paNoDevice; -@@ -541,7 +551,7 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta +- for( i = 0; i < 100; i++ ) ++ for( i = -1; i < 100; i++ ) + { + char deviceName[32]; PaDeviceInfo *deviceInfo; int testResult; - if( i == 0 ) -+ if( i == defaultDevice ) ++ if( i == -1 ) snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE); else snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i); -@@ -2041,5 +2051,29 @@ static signed long GetStreamWriteAvailable( PaStream* +@@ -2041,5 +2041,29 @@ static signed long GetStreamWriteAvailable( PaStream* error: return result; #endif |