Skip to content

Instantly share code, notes, and snippets.

@tgarc
Last active September 16, 2016 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgarc/678bb02b69201fd084e343927dc3d783 to your computer and use it in GitHub Desktop.
Save tgarc/678bb02b69201fd084e343927dc3d783 to your computer and use it in GitHub Desktop.
updated patch for compiling pyaudio for windows with msvc
diff --git a/setup.py b/setup.py
index cccebeb..1472d06 100755
--- a/setup.py
+++ b/setup.py
@@ -79,7 +79,9 @@ if not STATIC_LINKING:
else:
include_dirs = [os.path.join(portaudio_path, 'include/')]
extra_link_args = [
- os.path.join(portaudio_path, 'lib/.libs/libportaudio.a')
+ os.path.join(portaudio_path, 'portaudio_static_x64.lib')
+
+ # os.path.join(portaudio_path, 'lib/.libs/libportaudio.a')
]
# platform specific configuration
@@ -94,8 +96,10 @@ else:
elif sys.platform == 'win32':
# i.e., Win32 Python with mingw32
# run: python setup.py build -cmingw32
- external_libraries += ['winmm']
- extra_link_args += ['-lwinmm']
+ # external_libraries += ['winmm']
+ # extra_link_args += ['-lwinmm']
+ external_libraries += ['kernel32', 'user32', 'gdi32', 'winspool', 'shell32', 'ole32', 'oleaut32', 'uuid', 'comdlg32', 'advapi32']
+
elif sys.platform == 'linux2':
extra_link_args += ['-lrt', '-lm', '-lpthread']
# GNU/Linux has several audio systems (backends) available; be
diff --git a/src/_portaudiomodule.c b/src/_portaudiomodule.c
index b5bad08..f215bdf 100644
--- a/src/_portaudiomodule.c
+++ b/src/_portaudiomodule.c
@@ -36,12 +36,12 @@
#define DEFAULT_FRAMES_PER_BUFFER 1024
/* #define VERBOSE */
-#define min(a, b) \
- ({ \
- __typeof__(a) _a = (a); \
- __typeof__(b) _b = (b); \
- _a < _b ? _a : _b; \
- })
+// #define min(a, b) \
+// ({ \
+// __typeof__(a) _a = (a); \
+// __typeof__(b) _b = (b); \
+// _a < _b ? _a : _b; \
+// })
/************************************************************
*
@tgarc
Copy link
Author

tgarc commented Sep 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment