From c6ba54641bcf5e44fa914476d72455a524ed172f Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 10 Apr 2005 22:24:13 +0000 Subject: added xcode project cleaner error reporting added generic numpy support (not working) use lock count instead of message queuing to avoid py->py messaging deadlock fixing strange gcc behavior fixes for maxmsp support for buffer objects (preliminary) fixed reference count bug use optimized version updates for DSP processing adjust pd and py files for correct argument passing more optimizations fixed numarray headers little restructuring svn path=/trunk/; revision=2708 --- externals/grill/py/source/pydsp.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'externals/grill/py/source/pydsp.cpp') diff --git a/externals/grill/py/source/pydsp.cpp b/externals/grill/py/source/pydsp.cpp index 28d7d49b..cecefbe2 100644 --- a/externals/grill/py/source/pydsp.cpp +++ b/externals/grill/py/source/pydsp.cpp @@ -47,10 +47,12 @@ bool pydsp::DoInit() if(pyobj) { dspfun = PyObject_GetAttrString(pyobj,"_dsp"); // get ref - if(dspfun && !PyMethod_Check(dspfun)) { + if(!dspfun) + PyErr_Clear(); + else if(!PyMethod_Check(dspfun)) { Py_DECREF(dspfun); dspfun = NULL; - } + } } return true; } @@ -118,10 +120,13 @@ bool pydsp::CbDsp() NewBuffers(); + bool dodsp = true; if(dspfun) { PyObject *ret = PyObject_CallObject(dspfun,NULL); - if(ret) + if(ret) { + dodsp = PyObject_IsTrue(ret); Py_DECREF(ret); + } else { #ifdef FLEXT_DEBUG PyErr_Print(); @@ -135,11 +140,18 @@ bool pydsp::CbDsp() // _signal can be assigned in _dsp // optimizations may be done there to assign the right _signal version Py_XDECREF(sigfun); - sigfun = PyObject_GetAttrString(pyobj,"_signal"); // get ref - if(sigfun && !PyMethod_Check(sigfun)) { - Py_DECREF(sigfun); - sigfun = NULL; - } + + if(dodsp) { + sigfun = PyObject_GetAttrString(pyobj,"_signal"); // get ref + if(!sigfun) + PyErr_Clear(); + else if(!PyMethod_Check(sigfun)) { + Py_DECREF(sigfun); + sigfun = NULL; + } + } + else + sigfun = NULL; PyUnlock(state); return sigfun != NULL; -- cgit v1.2.1