Mercurial > hg > vampy-host
changeset 118:b56c1052d111
Merge
author | Chris Cannam |
---|---|
date | Wed, 17 Jun 2015 15:31:42 +0100 |
parents | 2370b942cd32 (current diff) 3489986a044c (diff) |
children | 36fed61cc3ac |
files | native/PyRealTime.cpp test/test_process.py |
diffstat | 3 files changed, 28 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.osx Wed Jun 17 15:31:16 2015 +0100 +++ b/Makefile.osx Wed Jun 17 15:31:42 2015 +0100 @@ -1,6 +1,11 @@ -PY_INCLUDE_PATH := /anaconda/include/python2.7 -NUMPY_INCLUDE_PATH := /anaconda/pkgs/numpy-1.9.2-py27_0/lib/python2.7/site-packages/numpy/core/include +PY_INCLUDE_PATH := /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 +NUMPY_INCLUDE_PATH := /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include + +## or e.g. +#PY_INCLUDE_PATH := /anaconda/include/python2.7 +#NUMPY_INCLUDE_PATH := /anaconda/pkgs/numpy-1.9.2-py27_0/lib/python2.7/site-packages/numpy/core/include + PY_LIB := python2.7 PY_TEST := nosetests @@ -9,18 +14,18 @@ #PY_LIB := python3 #PY_TEST := nosetests3 -ARCHFLAGS ?= -mmacosx-version-min=10.7 -arch x86_64 -arch i386 -stdlib=libc++ +ARCHFLAGS ?= -mmacosx-version-min=10.7 -arch x86_64 -stdlib=libc++ # Compile flags # CFLAGS += $(ARCHFLAGS) -fPIC -I$(PY_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I../vamp-plugin-sdk CXXFLAGS += $(ARCHFLAGS) -O2 -Wall -I. -fPIC -I$(PY_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I../vamp-plugin-sdk -LDFLAGS := -dynamiclib -L../vamp-plugin-sdk -lvamp-hostsdk -L/anaconda/lib/ -lpython -ldl +LDFLAGS := -dynamiclib -L../vamp-plugin-sdk -lvamp-hostsdk -l$(PY_LIB) -ldl NOSE := $(PY_TEST) -LIBRARY_EXT := .dylib +LIBRARY_EXT := .so MAKEFILE_EXT := .osx
--- a/native/PyRealTime.cpp Wed Jun 17 15:31:16 2015 +0100 +++ b/native/PyRealTime.cpp Wed Jun 17 15:31:42 2015 +0100 @@ -241,21 +241,27 @@ const RealTime &a = *ap; const RealTime &b = *bp; +// cerr << "a = " << a << ", b = " << b << ", op = " << op << endl; + + PyObject *result = Py_False; + if (op == Py_LT) { - return (a < b) ? Py_True : Py_False; + result = (a < b) ? Py_True : Py_False; } else if (op == Py_LE) { - return (a <= b) ? Py_True : Py_False; + result = (a <= b) ? Py_True : Py_False; } else if (op == Py_EQ) { - return (a == b) ? Py_True : Py_False; + result = (a == b) ? Py_True : Py_False; } else if (op == Py_NE) { - return (a != b) ? Py_True : Py_False; + result = (a != b) ? Py_True : Py_False; } else if (op == Py_GT) { - return (a > b) ? Py_True : Py_False; + result = (a > b) ? Py_True : Py_False; } else if (op == Py_GE) { - return (a >= b) ? Py_True : Py_False; - } else { - return Py_False; + result = (a >= b) ? Py_True : Py_False; } + +// cerr << "returning: " << (result == Py_True ? "true" : "false") << endl; + + return result; } /* String representation called by e.g. str(realtime), print realtime*/
--- a/test/test_process.py Wed Jun 17 15:31:16 2015 +0100 +++ b/test/test_process.py Wed Jun 17 15:31:42 2015 +0100 @@ -200,6 +200,8 @@ # half-way through the input buffer expected = i * (blocksize/2) + blocksize/2 actual = results[i]["values"][0] + if actual == 2047 and expected == 2048: + print("This test fails because of a bug in the Vamp plugin SDK. Please update to SDK version 2.6.") assert actual == expected def test_process_multi_freq_timestamps(): @@ -211,6 +213,8 @@ # half-way through the input buffer expected = i * (blocksize/2) + blocksize/2 actual = results[i]["input-timestamp"]["values"][0] + if actual == 2047 and expected == 2048: + print("This test fails because of a bug in the Vamp plugin SDK. Please update to SDK version 2.6.") assert actual == expected def test_process_multiple_outputs():