diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 17:12:27 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 17:27:07 +0200 |
| commit | 1689a1642e054750d9e17574eb012f242f0991c0 (patch) | |
| tree | 8a309cf67a37cab47ee17ec8ed339a800d2158c4 /sounddevice.py | |
| parent | 0529a60f464801f27817817b68410e5cd1e088f6 (diff) | |
Add submodule with binaries and adapt setup procedure
Diffstat (limited to 'sounddevice.py')
| -rw-r--r-- | sounddevice.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sounddevice.py b/sounddevice.py index b1c377a..b4f505f 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -27,6 +27,8 @@ __version__ = "0.1.0" import atexit as _atexit from cffi import FFI as _FFI +import os as _os +import platform as _platform import sys as _sys _ffi = _FFI() @@ -222,7 +224,20 @@ PaError Pa_GetSampleSize( PaSampleFormat format ); void Pa_Sleep( long msec ); """) -_lib = _ffi.dlopen("portaudio") +try: + _lib = _ffi.dlopen('portaudio') +except OSError: + if _platform.system() == 'Darwin': + _libname = 'libportaudio.dylib' + elif _platform.system() == 'Windows': + _libname = 'libportaudio' + _platform.architecture()[0] + '.dll' + else: + raise + _lib = _ffi.dlopen(_os.path.join( + _os.path.dirname(_os.path.abspath(__file__)), + '_sounddevice_data', + _libname + )) _sampleformats = { 'float32': _lib.paFloat32, |
