# HG changeset patch # User Chris Cannam # Date 1416996064 0 # Node ID fb6519598734abb354d7f6dd2a017b8e589324d4 # Parent 014c48d6f360337716646df1194baa1dee4243bb Some pruning diff -r 014c48d6f360 -r fb6519598734 Makefile --- a/Makefile Wed Nov 26 09:48:35 2014 +0000 +++ b/Makefile Wed Nov 26 10:01:04 2014 +0000 @@ -16,3 +16,13 @@ clean: rm -f *.o *.so *.a + +depend: + makedepend -Y -fMakefile *.cpp *.h + + +# DO NOT DELETE + +PyRealTime.o: PyRealTime.h +PyTypeConversions.o: PyTypeConversions.h +vampyhost.o: PyRealTime.h PyTypeConversions.h diff -r 014c48d6f360 -r fb6519598734 PyTypeConversions.cpp --- a/PyTypeConversions.cpp Wed Nov 26 09:48:35 2014 +0000 +++ b/PyTypeConversions.cpp Wed Nov 26 10:01:04 2014 +0000 @@ -57,7 +57,6 @@ PyTypeConversions::PyTypeConversions() : m_strict(false), m_error(false), - m_numpyInstalled(false), error(m_error) // const public reference for easy access { } @@ -66,6 +65,7 @@ { } + /// floating point numbers (TODO: check numpy.float128) float PyTypeConversions::PyValue_To_Float(PyObject* pyValue) const @@ -173,437 +173,13 @@ return 0.0; } -/// size_t (unsigned integer types) -size_t -PyTypeConversions::PyValue_To_Size_t(PyObject* pyValue) const -{ - // convert objects supporting the number protocol - if (PyNumber_Check(pyValue)) - { - if (m_strict && !PyInt_Check(pyValue) && !PyLong_Check(pyValue)) - setValueError("Strict conversion error: object is not integer type.",m_strict); - // Note: this function handles Bool,Int,Long,Float - // speed is not critical in the use of this type by Vamp - // PEP353: Py_ssize_t is size_t but signed ! - Py_ssize_t rValue = PyInt_AsSsize_t(pyValue); - if (PyErr_Occurred()) - { - PyErr_Print(); PyErr_Clear(); - setValueError("Error while converting integer object.",m_strict); - return 0; - } - // this test is nonsense -- neither part can occur - // owing to range of data types -- size_t is at least - // as big as long, and unsigned is always non-negative -/* - if ((unsigned long)rValue > SIZE_T_MAX || (unsigned long)rValue < 0) - { - setValueError("Overflow error. Object can not be converted to size_t.",m_strict); - return 0; - } -*/ - return (size_t) rValue; - } - - // in strict mode we will not try harder and throw an exception - // then the caller should decide what to do with it - if (m_strict) { - setValueError("Strict conversion error: object is not integer.",m_strict); - return 0; - } - - // convert string - if (PyString_Check(pyValue)) - { - PyObject* pyLong = PyNumber_Long(pyValue); - if (!pyLong) - { - if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - setValueError("String object can not be converted to size_t.",m_strict); - return 0; - } - size_t rValue = this->PyValue_To_Size_t(pyLong); - if (!m_error) { - Py_DECREF(pyLong); - return rValue; - } else { - Py_CLEAR(pyLong); - setValueError ("Error converting string to size_t.",m_strict); - return 0; - } - } - - // convert the first element of iterable sequences - if (PySequence_Check(pyValue) && PySequence_Size(pyValue) > 0) - { - PyObject* item = PySequence_GetItem(pyValue,0); - if (item) - { - size_t rValue = this->PyValue_To_Size_t(item); - if (!m_error) { - Py_DECREF(item); - return rValue; - } else { - Py_CLEAR(item); - setValueError("Could not convert sequence element to size_t. ",m_strict); - return 0; - } - } - } - - // give up - if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - std::string msg = "Conversion from " + this->PyValue_Get_TypeName(pyValue) + " to size_t is not possible."; - setValueError(msg,m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_To_Size_t failed. " << msg << endl; -#endif - return 0; -} - -/// long and int -long -PyTypeConversions::PyValue_To_Long(PyObject* pyValue) const -{ - // most common case: convert int (faster) - if (pyValue && PyInt_Check(pyValue)) { - // if the object is not NULL and verified, this macro just extracts the value. - return PyInt_AS_LONG(pyValue); - } - - // long - if (PyLong_Check(pyValue)) { - long rValue = PyLong_AsLong(pyValue); - if (PyErr_Occurred()) { - PyErr_Print(); PyErr_Clear(); - setValueError("Error while converting long object.",m_strict); - return 0; - } - return rValue; - } - - if (m_strict) { - setValueError("Strict conversion error: object is not integer or long integer.",m_strict); - return 0; - } - - // convert all objects supporting the number protocol - if (PyNumber_Check(pyValue)) - { - // Note: this function handles Bool,Int,Long,Float - // PEP353: Py_ssize_t is size_t but signed ! - Py_ssize_t rValue = PyInt_AsSsize_t(pyValue); - if (PyErr_Occurred()) - { - PyErr_Print(); PyErr_Clear(); - setValueError("Error while converting integer object.",m_strict); - return 0; - } - if (rValue > LONG_MAX || rValue < LONG_MIN) - { - setValueError("Overflow error. Object can not be converted to size_t.",m_strict); - return 0; - } - return (long) rValue; - } - - // convert string - if (PyString_Check(pyValue)) - { - PyObject* pyLong = PyNumber_Long(pyValue); - if (!pyLong) - { - if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - setValueError("String object can not be converted to long.",m_strict); - return 0; - } - long rValue = this->PyValue_To_Long(pyLong); - if (!m_error) { - Py_DECREF(pyLong); - return rValue; - } else { - Py_CLEAR(pyLong); - setValueError ("Error converting string to long.",m_strict); - return 0; - } - } - - // convert the first element of iterable sequences - if (PySequence_Check(pyValue) && PySequence_Size(pyValue) > 0) - { - PyObject* item = PySequence_GetItem(pyValue,0); - if (item) - { - size_t rValue = this->PyValue_To_Long(item); - if (!m_error) { - Py_DECREF(item); - return rValue; - } else { - Py_CLEAR(item); - setValueError("Could not convert sequence element to long. ",m_strict); - return 0; - } - } - } - - // give up - if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - std::string msg = "Conversion from " + this->PyValue_Get_TypeName(pyValue) + " to long is not possible."; - setValueError(msg,m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_To_Long failed. " << msg << endl; -#endif - return 0; -} - - -bool -PyTypeConversions::PyValue_To_Bool(PyObject* pyValue) const -{ - // convert objects supporting the number protocol - // Note: PyBool is a subclass of PyInt - if (PyNumber_Check(pyValue)) - { - if (m_strict && !PyBool_Check(pyValue)) - setValueError - ("Strict conversion error: object is not boolean type.",m_strict); - - // Note: this function handles Bool,Int,Long,Float - Py_ssize_t rValue = PyInt_AsSsize_t(pyValue); - if (PyErr_Occurred()) - { - PyErr_Print(); PyErr_Clear(); - setValueError ("Error while converting boolean object.",m_strict); - } - if (rValue != 1 && rValue != 0) - { - setValueError ("Overflow error. Object can not be converted to boolean.",m_strict); - } - return (bool) rValue; - } - - if (m_strict) { - setValueError ("Strict conversion error: object is not numerical type.",m_strict); - return false; - } - - // convert iterables: the rule is the same as in the interpreter: - // empty sequence evaluates to False, anything else is True - if (PySequence_Check(pyValue)) - { - return PySequence_Size(pyValue)?true:false; - } - - // give up - if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - std::string msg = "Conversion from " + this->PyValue_Get_TypeName(pyValue) + " to boolean is not possible."; - setValueError(msg,m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_To_Bool failed. " << msg << endl; -#endif - return false; -} - -/// string and objects that support .__str__() -/// TODO: check unicode objects -std::string -PyTypeConversions::PyValue_To_String(PyObject* pyValue) const -{ - // convert string - if (PyString_Check(pyValue)) - { - char *cstr = PyString_AS_STRING(pyValue); - if (!cstr) - { - if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} - setValueError("Error while converting string object.",m_strict); - return std::string(); - } - return std::string(cstr); - } - // TODO: deal with unicode here (argh!) - - // in strict mode we will not try harder - if (m_strict) { - setValueError("Strict conversion error: object is not string.",m_strict); - return std::string(); - } - - // accept None as empty string - if (pyValue == Py_None) return std::string(); - - // convert list or tuple: empties are turned into empty strings conventionally - if (PyList_Check(pyValue) || PyTuple_Check(pyValue)) - { - if (!PySequence_Size(pyValue)) return std::string(); - PyObject* item = PySequence_GetItem(pyValue,0); - if (item) - { - std::string rValue = this->PyValue_To_String(item); - if (!m_error) { - Py_DECREF(item); - return rValue; - } else { - Py_CLEAR(item); - setValueError("Could not convert sequence element to string.",m_strict); - return std::string(); - } - } - } - - // convert any other object that has .__str__() or .__repr__() - PyObject* pyString = PyObject_Str(pyValue); - if (pyString && !PyErr_Occurred()) - { - std::string rValue = this->PyValue_To_String(pyString); - if (!m_error) { - Py_DECREF(pyString); - return rValue; - } else { - Py_CLEAR(pyString); - std::string msg = "Object " + this->PyValue_Get_TypeName(pyValue) +" can not be represented as string. "; - setValueError (msg,m_strict); - return std::string(); - } - } - - // give up - PyErr_Print(); PyErr_Clear(); - std::string msg = "Conversion from " + this->PyValue_Get_TypeName(pyValue) + " to string is not possible."; - setValueError(msg,m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_To_String failed. " << msg << endl; -#endif - return std::string(); -} - -/* C Values to Py Values */ - - -PyObject* -PyTypeConversions::PyValue_From_CValue(const char* cValue) const -{ - // returns new reference -#ifdef _DEBUG - if (!cValue) { - std::string msg = "PyTypeConversions::PyValue_From_CValue: Null pointer encountered while converting from const char* ."; - cerr << msg << endl; - setValueError(msg,m_strict); - return NULL; - } -#endif - PyObject *pyValue = PyString_FromString(cValue); - if (!pyValue) - { - if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} - setValueError("Error while converting from char* or string.",m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_From_CValue: Interpreter failed to convert from const char*" << endl; -#endif - return NULL; - } - return pyValue; -} - -PyObject* -PyTypeConversions::PyValue_From_CValue(size_t cValue) const -{ - // returns new reference - PyObject *pyValue = PyInt_FromSsize_t((Py_ssize_t)cValue); - if (!pyValue) - { - if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} - setValueError("Error while converting from size_t.",m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_From_CValue: Interpreter failed to convert from size_t" << endl; -#endif - return NULL; - } - return pyValue; -} - -PyObject* -PyTypeConversions::PyValue_From_CValue(double cValue) const -{ - // returns new reference - PyObject *pyValue = PyFloat_FromDouble(cValue); - if (!pyValue) - { - if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} - setValueError("Error while converting from float or double.",m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_From_CValue: Interpreter failed to convert from float or double" << endl; -#endif - return NULL; - } - return pyValue; -} - -PyObject* -PyTypeConversions::PyValue_From_CValue(bool cValue) const -{ - // returns new reference - PyObject *pyValue = PyBool_FromLong((long)cValue); - if (!pyValue) - { - if (PyErr_Occurred()) {PyErr_Print(); PyErr_Clear();} - setValueError("Error while converting from bool.",m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_From_CValue: Interpreter failed to convert from bool" << endl; -#endif - return NULL; - } - return pyValue; -} - /* Sequence Types to C++ Types */ -//convert Python list to C++ vector of strings -std::vector -PyTypeConversions::PyValue_To_StringVector (PyObject *pyList) const -{ - - std::vector Output; - std::string ListElement; - PyObject *pyString = NULL; - - if (PyList_Check(pyList)) { - - for (Py_ssize_t i = 0; i < PyList_GET_SIZE(pyList); ++i) { - //Get next list item (Borrowed Reference) - pyString = PyList_GET_ITEM(pyList,i); - ListElement = (string) PyString_AsString(PyObject_Str(pyString)); - Output.push_back(ListElement); - } - return Output; - } - -// #ifdef _DEBUG -// cerr << "PyTypeConversions::PyValue_To_StringVector: Warning: Value is not list of strings." << endl; -// #endif - - /// Assume a single value that can be casted as string - /// this allows to write e.g. Feature.label = 5.2 instead of ['5.2'] - Output.push_back(PyValue_To_String(pyList)); - if (m_error) { - std::string msg = "Value is not list of strings nor can be casted as string. "; - setValueError(msg,m_strict); -#ifdef _DEBUG - cerr << "PyTypeConversions::PyValue_To_StringVector failed. " << msg << endl; -#endif - } - return Output; -} - //convert PyFeature.value (typically a list or numpy array) to C++ vector of floats std::vector PyTypeConversions::PyValue_To_FloatVector (PyObject *pyValue) const { - -#ifdef HAVE_NUMPY -if (m_numpyInstalled) -{ // there are four types of values we may receive from a numpy process: // * a python scalar, // * an array scalar, (e.g. numpy.float32) @@ -625,8 +201,6 @@ /// numpy array if (PyArray_CheckExact(pyValue)) return PyArray_To_FloatVector(pyValue); -} -#endif /// python list of floats (backward compatible) if (PyList_Check(pyValue)) { @@ -697,7 +271,6 @@ // if numpy is not installed this will not be called, // therefor we do not check again -#ifdef HAVE_NUMPY std::vector PyTypeConversions::PyArray_To_FloatVector (PyObject *pyValue) const { @@ -777,7 +350,6 @@ } return arr; } -#endif PyObject * PyTypeConversions::PyValue_From_StringVector(const std::vector &v) const diff -r 014c48d6f360 -r fb6519598734 PyTypeConversions.h --- a/PyTypeConversions.h Wed Nov 26 09:48:35 2014 +0000 +++ b/PyTypeConversions.h Wed Nov 26 10:01:04 2014 +0000 @@ -1,43 +1,43 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* - VampyHost + VampyHost - Use Vamp audio analysis plugins in Python + Use Vamp audio analysis plugins in Python - Gyorgy Fazekas and Chris Cannam - Centre for Digital Music, Queen Mary, University of London - Copyright 2008-2014 Queen Mary, University of London + Gyorgy Fazekas and Chris Cannam + Centre for Digital Music, Queen Mary, University of London + Copyright 2008-2014 Queen Mary, University of London - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - Except as contained in this notice, the names of the Centre for - Digital Music; Queen Mary, University of London; and the authors - shall not be used in advertising or otherwise to promote the sale, - use or other dealings in this Software without prior written - authorization. + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and the authors + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. */ /* - PyTypeConversions: Type safe conversion utilities between Python - types and basic C/C++ types. + PyTypeConversions: Type safe conversion utilities between Python + types and basic C/C++ types. */ #ifndef PY_TYPE_CONVERSIONS_H @@ -45,12 +45,11 @@ #include -#ifdef HAVE_NUMPY -#define PY_ARRAY_UNIQUE_SYMBOL VAMPY_ARRAY_API +// NumPy is required here +#define PY_ARRAY_UNIQUE_SYMBOL VAMPYHOST_ARRAY_API #define NO_IMPORT_ARRAY #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include "numpy/arrayobject.h" -#endif #include #include @@ -58,14 +57,11 @@ #include #include -using std::cerr; -using std::endl; - #ifdef HAVE_NUMPY enum eArrayDataType { - dtype_float32 = (int) NPY_FLOAT, - dtype_complex64 = (int) NPY_CFLOAT - }; + dtype_float32 = (int) NPY_FLOAT, + dtype_complex64 = (int) NPY_CFLOAT +}; #endif /* C++ mapping of PyNone Type */ @@ -75,123 +71,100 @@ class ValueError { public: - ValueError() {} - ValueError(std::string m, bool s) : message(m),strict(s) {} - std::string location; - std::string message; - bool strict; - std::string str() const { - return (location.empty()) ? message : message + "\nLocation: " + location;} - void print() const { cerr << str() << endl; } - template ValueError &operator<< (const V& v) - { - std::ostringstream ss; - ss << v; - location += ss.str(); - return *this; - } + ValueError() {} + ValueError(std::string m, bool s) : message(m),strict(s) {} + std::string location; + std::string message; + bool strict; + std::string str() const { + return (location.empty()) ? message : message + "\nLocation: " + location;} + template ValueError &operator<< (const V& v) + { + std::ostringstream ss; + ss << v; + location += ss.str(); + return *this; + } }; class PyTypeConversions { public: - PyTypeConversions(); - ~PyTypeConversions(); + PyTypeConversions(); + ~PyTypeConversions(); + + ValueError getError() const; + std::string PyValue_Get_TypeName(PyObject*) const; + float PyValue_To_Float(PyObject*) const; + + // Sequence types + std::vector PyValue_To_StringVector (PyObject*) const; + std::vector PyValue_To_FloatVector (PyObject*) const; + std::vector PyList_To_FloatVector (PyObject*) const; + + PyObject *PyValue_From_StringVector(const std::vector &) const; - // Utilities - void setStrictTypingFlag(bool b) {m_strict = b;} - void setNumpyInstalled(bool b) {m_numpyInstalled = b;} - ValueError getError() const; - std::string PyValue_Get_TypeName(PyObject*) const; + // Numpy types + std::vector PyArray_To_FloatVector (PyObject *pyValue) const; + PyObject *FloatVector_To_PyArray(const std::vector &) const; // Copying the data - // Basic type conversion: Python to C++ - float PyValue_To_Float(PyObject*) const; - size_t PyValue_To_Size_t(PyObject*) const; - bool PyValue_To_Bool(PyObject*) const; - std::string PyValue_To_String(PyObject*) const; - long PyValue_To_Long(PyObject*) const; - // int PyValue_To_Int(PyObject* pyValue) const; - - // C++ to Python - PyObject *PyValue_From_CValue(const char*) const; - PyObject *PyValue_From_CValue(const std::string& x) const { return PyValue_From_CValue(x.c_str()); } - PyObject *PyValue_From_CValue(size_t) const; - PyObject *PyValue_From_CValue(double) const; - PyObject *PyValue_From_CValue(float x) const { return PyValue_From_CValue((double)x); } - PyObject *PyValue_From_CValue(bool) const; - - // Sequence types - std::vector PyValue_To_StringVector (PyObject*) const; - std::vector PyValue_To_FloatVector (PyObject*) const; - std::vector PyList_To_FloatVector (PyObject*) const; + /// Convert DTYPE type 1D NumpyArray to std::vector + template + std::vector PyArray_Convert(void* raw_data_ptr, long length, size_t strides) const + { + std::vector rValue; + + /// check if the array is continuous, if not use strides info + if (sizeof(DTYPE)!=strides) { +#ifdef _DEBUG_VALUES + cerr << "Warning: discontinuous numpy array. Strides: " << strides << " bytes. sizeof(dtype): " << sizeof(DTYPE) << endl; +#endif + char* data = (char*) raw_data_ptr; + for (long i = 0; i &) const; - - // Numpy types -#ifdef HAVE_NUMPY - std::vector PyArray_To_FloatVector (PyObject *pyValue) const; - PyObject *FloatVector_To_PyArray(const std::vector &) const; // Copying the data + DTYPE* data = (DTYPE*) raw_data_ptr; + for (long i = 0; i - template - std::vector PyArray_Convert(void* raw_data_ptr, long length, size_t strides) const - { - std::vector rValue; - - /// check if the array is continuous, if not use strides info - if (sizeof(DTYPE)!=strides) { + /// this is a special case. numpy.float64 has an array conversions but no array descriptor + std::vector PyArray0D_Convert(PyArrayInterface *ai) const + { + std::vector rValue; + if ((ai->typekind) == *"f") + rValue.push_back((float)*(double*)(ai->data)); + else { + setValueError("Unsupported NumPy data type.",m_strict); + return rValue; + } #ifdef _DEBUG_VALUES - cerr << "Warning: discontinuous numpy array. Strides: " << strides << " bytes. sizeof(dtype): " << sizeof(DTYPE) << endl; + cerr << "value: " << rValue[0] << endl; #endif - char* data = (char*) raw_data_ptr; - for (long i = 0; i PyArray0D_Convert(PyArrayInterface *ai) const - { - std::vector rValue; - if ((ai->typekind) == *"f") - rValue.push_back((float)*(double*)(ai->data)); - else { - setValueError("Unsupported NumPy data type.",m_strict); - return rValue; - } -#ifdef _DEBUG_VALUES - cerr << "value: " << rValue[0] << endl; -#endif - return rValue; - } + return rValue; + } private: - bool m_strict; - mutable bool m_error; - mutable std::queue m_errorQueue; - bool m_numpyInstalled; + bool m_strict; + mutable bool m_error; + mutable std::queue m_errorQueue; - void setValueError(std::string,bool) const; - ValueError& lastError() const; - + void setValueError(std::string,bool) const; + ValueError& lastError() const; public: - const bool& error; + const bool& error; }; diff -r 014c48d6f360 -r fb6519598734 vampyhost.cpp --- a/vampyhost.cpp Wed Nov 26 09:48:35 2014 +0000 +++ b/vampyhost.cpp Wed Nov 26 10:01:04 2014 +0000 @@ -41,7 +41,7 @@ #include // define a unique API pointer -#define PY_ARRAY_UNIQUE_SYMBOL VAMPY_ARRAY_API +#define PY_ARRAY_UNIQUE_SYMBOL VAMPYHOST_ARRAY_API #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include "numpy/arrayobject.h" @@ -440,7 +440,6 @@ float **inbuf = new float *[channels]; PyTypeConversions typeConv; - typeConv.setNumpyInstalled(true); cerr << "here!" << endl; @@ -472,7 +471,6 @@ cerr << "no no no, here!" << endl; PyTypeConversions conv; - conv.setNumpyInstalled(true); PyObject *pyFs = PyDict_New();