shithub: aubio

Download patch

ref: bf3f09b5a18deb2d308292b855e895ec86d85ca0
parent: d06c9a45dc272ee6ca10000c54d02b2abdfaa031
parent: 5eea3b251c88d6e5523d7a30a2b83ad9475d5434
author: Paul Brossier <piem@piem.org>
date: Wed Nov 21 07:59:31 EST 2018

Merge branch 'master' into feature/pytest

--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -3,9 +3,6 @@
 
 environment:
 
-  global:
-      CUSTOM64PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
-
   matrix:
 
     # pre-installed python version, see:
@@ -43,14 +40,11 @@
       PYTHON_ARCH: 64
 
 install:
-
   - ECHO "Installed SDKs:"
   - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
 
   - "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
 
-  - if [%PYTHON_ARCH%]==[64] SET PATH=%CUSTOM64PATH%;%PATH%
-
   # Check that we have the expected version and architecture for Python
   - "python --version"
   - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
@@ -71,8 +65,6 @@
   - python waf configure build install --verbose --msvc_version="msvc 14.0"
   # clean before building python package
   - python waf distclean
-  # build python module without using libaubio
-  - pip wheel -v -v -v --wheel-dir=dist .
   # build, upload and install wheel (inspired by numpy's appveyor)
   - ps: |
       pip wheel -v -v -v --wheel-dir=dist .
--- a/python/ext/py-filterbank.c
+++ b/python/ext/py-filterbank.c
@@ -122,8 +122,8 @@
   uint_t err = 0;
 
   PyObject *input;
-  uint_t samplerate;
-  if (!PyArg_ParseTuple (args, "OI", &input, &samplerate)) {
+  smpl_t samplerate;
+  if (!PyArg_ParseTuple (args, "O" AUBIO_NPY_SMPL_CHR, &input, &samplerate)) {
     return NULL;
   }
 
@@ -268,9 +268,9 @@
 static PyObject *
 Py_filterbank_set_power(Py_filterbank *self, PyObject *args)
 {
-  uint_t power;
+  smpl_t power;
 
-  if (!PyArg_ParseTuple (args, "I", &power)) {
+  if (!PyArg_ParseTuple (args, AUBIO_NPY_SMPL_CHR, &power)) {
     return NULL;
   }
   if(aubio_filterbank_set_power (self->o, power)) {
@@ -291,12 +291,12 @@
 static PyObject *
 Py_filterbank_set_norm(Py_filterbank *self, PyObject *args)
 {
-  uint_t playing;
+  smpl_t norm;
 
-  if (!PyArg_ParseTuple (args, "I", &playing)) {
+  if (!PyArg_ParseTuple (args, AUBIO_NPY_SMPL_CHR, &norm)) {
     return NULL;
   }
-  if(aubio_filterbank_set_norm (self->o, playing)) {
+  if(aubio_filterbank_set_norm (self->o, norm)) {
     if (PyErr_Occurred() == NULL) {
       PyErr_SetString (PyExc_ValueError,
           "error running filterbank.set_power");
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -155,7 +155,7 @@
 "...     for samples in source:\n"
 "...         n_frames += len(samples)\n"
 "...     print('read', n_frames, 'samples in', samples.shape[0], 'channels',\n"
-"...         'from file \"\%s\"' \% source.uri)\n"
+"...         'from file \"%%s\"' %% source.uri)\n"
 "...\n"
 "read 239334 samples in 2 channels from file \"audiotrack.wav\"\n"
 "\n"
--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -74,6 +74,18 @@
         cpp_cmd = compiler.cc.split()
         cpp_cmd += ['-E']
 
+    # On win-amd64 (py3.x), the default compiler is cross-compiling, from x86
+    # to amd64 with %WIN_SDK_ROOT%\x86_amd64\cl.exe, but using this binary as a
+    # pre-processor generates no output, so we use %WIN_SDK_ROOT%\cl.exe
+    # instead.
+    if len(cpp_cmd) > 1 and 'cl.exe' in cpp_cmd[-2]:
+        plat = os.path.basename(os.path.dirname(cpp_cmd[-2]))
+        if plat == 'x86_amd64':
+            print('workaround on win64 to avoid empty pre-processor output')
+            cpp_cmd[-2] = cpp_cmd[-2].replace('x86_amd64', '')
+        elif True in ['amd64' in f for f in cpp_cmd]:
+            print('warning: not using workaround for', cpp_cmd[0], plat)
+
     if not cpp_cmd:
         print("Warning: could not guess preprocessor, using env's CC")
         cpp_cmd = os.environ.get('CC', 'cc').split()
--- a/python/tests/test_mfcc.py
+++ b/python/tests/test_mfcc.py
@@ -135,7 +135,7 @@
     def test_set_mel_coeffs_slaney(self):
         buf_size, n_filters, n_coeffs, samplerate = 512, 40, 10, 16000
         m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
-        m.set_mel_coeffs_slaney(samplerate)
+        m.set_mel_coeffs_slaney()
         m(cvec(buf_size))
         assert m.get_power() == 1
         assert m.get_scale() == 1
--- a/scripts/get_waf.sh
+++ b/scripts/get_waf.sh
@@ -3,7 +3,7 @@
 set -e
 #set -x
 
-WAFVERSION=2.0.11
+WAFVERSION=2.0.12
 WAFTARBALL=waf-$WAFVERSION.tar.bz2
 WAFURL=https://waf.io/$WAFTARBALL
 WAFUPSTREAMKEY=https://gitlab.com/ita1024/waf/raw/master/utils/pubkey.asc