Skip to content

Commit 5eb0041

Browse files
committed
Try to load the PortAudio DLL from conda-forge
1 parent b4de7fd commit 5eb0041

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

sounddevice.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@
5959

6060

6161
try:
62-
_libname = _find_library('portaudio')
63-
if _libname is None:
62+
for _libname in (
63+
'portaudio', # Default name on POSIX systems
64+
'bin\\libportaudio-2.dll', # DLL from conda-forge
65+
):
66+
_libname = _find_library(_libname)
67+
if _libname is not None:
68+
break
69+
else:
6470
raise OSError('PortAudio library not found')
6571
_lib = _ffi.dlopen(_libname)
6672
except OSError:
@@ -71,8 +77,9 @@
7177
else:
7278
raise
7379
import _sounddevice_data
74-
_lib = _ffi.dlopen(_os.path.join(next(iter(_sounddevice_data.__path__)),
75-
'portaudio-binaries', _libname))
80+
_libname = _os.path.join(
81+
next(iter(_sounddevice_data.__path__)), 'portaudio-binaries', _libname)
82+
_lib = _ffi.dlopen(_libname)
7683

7784
_sampleformats = {
7885
'float32': _lib.paFloat32,

0 commit comments

Comments
 (0)