diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-10 22:24:13 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-10 22:24:13 +0000 |
commit | c6ba54641bcf5e44fa914476d72455a524ed172f (patch) | |
tree | 162399832d1ec063b0863b99d49ce3ff35072b0a /externals/grill/py/source/pydsp.cpp | |
parent | ce10fc0a7c760656a3577068e1457043a3d6ffd1 (diff) |
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
Diffstat (limited to 'externals/grill/py/source/pydsp.cpp')
-rw-r--r-- | externals/grill/py/source/pydsp.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
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;
|