aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/py/pd/sig-1.pd8
-rw-r--r--externals/grill/py/pd/sig-2.pd46
-rw-r--r--externals/grill/py/py.xcode/project.pbxproj516
-rw-r--r--externals/grill/py/scripts/sig.py14
-rw-r--r--externals/grill/py/source/clmeth.cpp2
-rw-r--r--externals/grill/py/source/main.cpp5
-rw-r--r--externals/grill/py/source/main.h1
-rw-r--r--externals/grill/py/source/modmeth.cpp1
-rw-r--r--externals/grill/py/source/py.cpp2
-rw-r--r--externals/grill/py/source/pybuffer.cpp46
-rw-r--r--externals/grill/py/source/pydsp.cpp28
-rw-r--r--externals/grill/py/source/pyext.cpp7
12 files changed, 612 insertions, 64 deletions
diff --git a/externals/grill/py/pd/sig-1.pd b/externals/grill/py/pd/sig-1.pd
index 88d38e89..61342810 100644
--- a/externals/grill/py/pd/sig-1.pd
+++ b/externals/grill/py/pd/sig-1.pd
@@ -1,11 +1,11 @@
-#N canvas 52 147 659 311 12;
+#N canvas 52 147 663 315 12;
#X obj 56 234 dac~;
#X msg 523 211 \; pd dsp 1;
#X obj 524 184 loadbang;
#X obj 194 114 hsl 128 15 0.01 1 1 1 empty empty gain -2 -6 0 8 -225271
--1 -1 0 1;
+-1 -1 11200 1;
#X obj 89 116 noise~;
-#X msg 28 117 reload;
+#X msg 21 116 reload;
#X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818
-1 0;
#X text 213 32 http://grrrr.org/ext;
@@ -13,7 +13,7 @@
#X text 17 66 This demonstrates signal support. See the sig.py file.
;
#X obj 191 131 nbx 5 14 0.001 1 1 0 empty empty empty 0 -6 0 10 -225271
--1 -1 0.001 256;
+-1 -1 0.58047 256;
#X msg 192 148 set gain \$1;
#X text 123 202 message inlets \, outlets;
#X text 123 217 signal inlets \, outlets;
diff --git a/externals/grill/py/pd/sig-2.pd b/externals/grill/py/pd/sig-2.pd
index 0e641600..699154d8 100644
--- a/externals/grill/py/pd/sig-2.pd
+++ b/externals/grill/py/pd/sig-2.pd
@@ -1,23 +1,23 @@
-#N canvas 56 67 659 311 12;
-#X obj 121 246 dac~;
-#X msg 523 211 \; pd dsp 1;
-#X obj 524 184 loadbang;
-#X obj 266 134 hsl 128 15 0 1 0 1 empty empty pan -2 -6 0 8 -225271
--1 -1 6500 1;
-#X obj 92 126 noise~;
-#X msg 31 127 reload;
-#X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818
--1 0;
-#X text 213 32 http://grrrr.org/ext;
-#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill;
-#X text 17 66 This demonstrates signal support. See the sig.py file.
-;
-#X obj 92 179 pyext~ 1 0 1 2 sig pan;
-#X text 185 202 message inlets \, outlets;
-#X text 183 218 signal inlets \, outlets;
-#X connect 2 0 1 0;
-#X connect 3 0 10 1;
-#X connect 4 0 10 0;
-#X connect 5 0 10 0;
-#X connect 10 0 0 0;
-#X connect 10 1 0 1;
+#N canvas 56 67 663 315 12;
+#X obj 121 246 dac~;
+#X msg 523 211 \; pd dsp 1;
+#X obj 524 184 loadbang;
+#X obj 266 134 hsl 128 15 0 1 0 1 empty empty pan -2 -6 0 8 -225271
+-1 -1 4700 1;
+#X obj 100 127 noise~;
+#X msg 31 127 reload;
+#X obj 16 13 cnv 15 600 40 empty empty py/pyext 10 22 0 24 -260818
+-1 0;
+#X text 213 32 http://grrrr.org/ext;
+#X text 213 16 Python script objects \, (C)2003-2005 Thomas Grill;
+#X text 17 66 This demonstrates signal support. See the sig.py file.
+;
+#X obj 92 179 pyext~ 1 0 1 2 sig pan;
+#X text 185 202 message inlets \, outlets;
+#X text 183 218 signal inlets \, outlets;
+#X connect 2 0 1 0;
+#X connect 3 0 10 1;
+#X connect 4 0 10 0;
+#X connect 5 0 10 0;
+#X connect 10 0 0 0;
+#X connect 10 1 0 1;
diff --git a/externals/grill/py/py.xcode/project.pbxproj b/externals/grill/py/py.xcode/project.pbxproj
new file mode 100644
index 00000000..3bc57f99
--- /dev/null
+++ b/externals/grill/py/py.xcode/project.pbxproj
@@ -0,0 +1,516 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 39;
+ objects = {
+ 089C1669FE841209C02AAC07 = {
+ buildSettings = {
+ };
+ buildStyles = (
+ 4F9091AC011F3BD104CA0E50,
+ 4F9091AD011F3BD104CA0E50,
+ );
+ hasScannedForEncodings = 1;
+ isa = PBXProject;
+ mainGroup = 089C166AFE841209C02AAC07;
+ projectDirPath = "";
+ targets = (
+ E90E52E508092505001341AC,
+ );
+ };
+ 089C166AFE841209C02AAC07 = {
+ children = (
+ 08FB77ADFE841716C02AAC07,
+ 089C1671FE841209C02AAC07,
+ 19C28FB4FE9D528D11CA2CBB,
+ );
+ isa = PBXGroup;
+ name = py;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 089C1671FE841209C02AAC07 = {
+ children = (
+ E90E52D208091F79001341AC,
+ E90E521108091CA5001341AC,
+ E90E51FD08091A06001341AC,
+ E90E51FB080919EC001341AC,
+ );
+ isa = PBXGroup;
+ name = "External Frameworks and Libraries";
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 08FB77ADFE841716C02AAC07 = {
+ children = (
+ E90E51DB08091989001341AC,
+ E90E51DC08091989001341AC,
+ E90E51DD08091989001341AC,
+ E90E51DE08091989001341AC,
+ E90E51DF08091989001341AC,
+ E90E51E008091989001341AC,
+ E90E51E108091989001341AC,
+ E90E51E208091989001341AC,
+ E90E51E308091989001341AC,
+ E90E51E408091989001341AC,
+ E90E51E508091989001341AC,
+ E90E51E608091989001341AC,
+ E90E51E708091989001341AC,
+ E90E51E808091989001341AC,
+ E90E51E908091989001341AC,
+ E90E51EA08091989001341AC,
+ );
+ isa = PBXGroup;
+ name = Source;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//080
+//081
+//082
+//083
+//084
+//190
+//191
+//192
+//193
+//194
+ 19C28FB4FE9D528D11CA2CBB = {
+ children = (
+ E90E52E608092505001341AC,
+ );
+ isa = PBXGroup;
+ name = Products;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//190
+//191
+//192
+//193
+//194
+//4F0
+//4F1
+//4F2
+//4F3
+//4F4
+ 4F9091AC011F3BD104CA0E50 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = "$(GCC_PREPROCESSOR_DEFINITIONS) FLEXT_DEBUG";
+ OPTIMIZATION_CFLAGS = "-O0";
+ ZERO_LINK = YES;
+ };
+ isa = PBXBuildStyle;
+ name = Development;
+ };
+ 4F9091AD011F3BD104CA0E50 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ ZERO_LINK = NO;
+ };
+ isa = PBXBuildStyle;
+ name = Deployment;
+ };
+//4F0
+//4F1
+//4F2
+//4F3
+//4F4
+//E90
+//E91
+//E92
+//E93
+//E94
+ E90E51DB08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = bound.cpp;
+ path = source/bound.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51DC08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = clmeth.cpp;
+ path = source/clmeth.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51DD08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = main.cpp;
+ path = source/main.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51DE08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = main.h;
+ path = source/main.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51DF08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = modmeth.cpp;
+ path = source/modmeth.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E008091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = py.cpp;
+ path = source/py.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E108091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = pyargs.cpp;
+ path = source/pyargs.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E208091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = pybuffer.cpp;
+ path = source/pybuffer.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E308091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = pybuffer.h;
+ path = source/pybuffer.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E408091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = pydsp.cpp;
+ path = source/pydsp.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E508091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = pyext.cpp;
+ path = source/pyext.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E608091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = pyext.h;
+ path = source/pyext.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E708091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = pyprefix.h;
+ path = source/pyprefix.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E808091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = pysymbol.cpp;
+ path = source/pysymbol.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51E908091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = pysymbol.h;
+ path = source/pysymbol.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51EA08091989001341AC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = register.cpp;
+ path = source/register.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ E90E51FB080919EC001341AC = {
+ isa = PBXFileReference;
+ lastKnownFileType = wrapper.framework;
+ name = Python.framework;
+ path = /System/Library/Frameworks/Python.framework;
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ E90E51FD08091A06001341AC = {
+ isa = PBXFileReference;
+ lastKnownFileType = archive.ar;
+ name = "libflext-pd_t.a";
+ path = "/usr/local/lib/libflext-pd_t.a";
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ E90E521108091CA5001341AC = {
+ isa = PBXFileReference;
+ lastKnownFileType = wrapper.framework;
+ name = ApplicationServices.framework;
+ path = /System/Library/Frameworks/ApplicationServices.framework;
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ E90E52D208091F79001341AC = {
+ isa = PBXFileReference;
+ lastKnownFileType = wrapper.framework;
+ name = vecLib.framework;
+ path = /System/Library/Frameworks/vecLib.framework;
+ refType = 0;
+ sourceTree = "<absolute>";
+ };
+ E90E52E208092505001341AC = {
+ buildActionMask = 2147483647;
+ files = (
+ E90E52E908092581001341AC,
+ E90E52EA08092581001341AC,
+ E90E52EB08092581001341AC,
+ E90E52EC08092581001341AC,
+ E90E52ED08092581001341AC,
+ );
+ isa = PBXHeadersBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ E90E52E308092505001341AC = {
+ buildActionMask = 2147483647;
+ files = (
+ E90E52EE0809258A001341AC,
+ E90E52EF0809258A001341AC,
+ E90E52F00809258A001341AC,
+ E90E52F10809258A001341AC,
+ E90E52F20809258A001341AC,
+ E90E52F30809258A001341AC,
+ E90E52F40809258A001341AC,
+ E90E52F50809258A001341AC,
+ E90E52F60809258A001341AC,
+ E90E52F70809258A001341AC,
+ E90E52F80809258A001341AC,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ E90E52E408092505001341AC = {
+ buildActionMask = 2147483647;
+ files = (
+ E90E535B08092593001341AC,
+ E90E535C08092593001341AC,
+ E90E535D08092593001341AC,
+ E90E535E08092593001341AC,
+ );
+ isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ E90E52E508092505001341AC = {
+ buildPhases = (
+ E90E52E208092505001341AC,
+ E90E52E308092505001341AC,
+ E90E52E408092505001341AC,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ EXECUTABLE_EXTENSION = pd_darwin;
+ GCC_ALTIVEC_EXTENSIONS = YES;
+ GCC_MODEL_CPU = G4;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = source/pyprefix.h;
+ GCC_PREPROCESSOR_DEFINITIONS = "FLEXT_SYS=2 FLEXT_THREADS";
+ HEADER_SEARCH_PATHS = "/usr/local/include/flext $(PDApp)/src";
+ INSTALL_PATH = "$(PDApp)/extra";
+ LIBRARY_STYLE = BUNDLE;
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "-bundle_loader $(PDApp)/bin/pd";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = py;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ dependencies = (
+ );
+ isa = PBXNativeTarget;
+ name = py;
+ productName = py;
+ productReference = E90E52E608092505001341AC;
+ productType = "com.apple.product-type.library.dynamic";
+ };
+ E90E52E608092505001341AC = {
+ explicitFileType = "compiled.mach-o.dylib";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = py.pd_darwin;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ E90E52E908092581001341AC = {
+ fileRef = E90E51DE08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52EA08092581001341AC = {
+ fileRef = E90E51E308091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52EB08092581001341AC = {
+ fileRef = E90E51E608091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52EC08092581001341AC = {
+ fileRef = E90E51E708091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52ED08092581001341AC = {
+ fileRef = E90E51E908091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52EE0809258A001341AC = {
+ fileRef = E90E51DB08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52EF0809258A001341AC = {
+ fileRef = E90E51DC08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F00809258A001341AC = {
+ fileRef = E90E51DD08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F10809258A001341AC = {
+ fileRef = E90E51DF08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F20809258A001341AC = {
+ fileRef = E90E51E008091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F30809258A001341AC = {
+ fileRef = E90E51E108091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F40809258A001341AC = {
+ fileRef = E90E51E208091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F50809258A001341AC = {
+ fileRef = E90E51E408091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F60809258A001341AC = {
+ fileRef = E90E51E508091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F70809258A001341AC = {
+ fileRef = E90E51E808091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E52F80809258A001341AC = {
+ fileRef = E90E51EA08091989001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E535B08092593001341AC = {
+ fileRef = E90E51FB080919EC001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E535C08092593001341AC = {
+ fileRef = E90E51FD08091A06001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E535D08092593001341AC = {
+ fileRef = E90E521108091CA5001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ E90E535E08092593001341AC = {
+ fileRef = E90E52D208091F79001341AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ };
+ rootObject = 089C1669FE841209C02AAC07;
+}
diff --git a/externals/grill/py/scripts/sig.py b/externals/grill/py/scripts/sig.py
index 23fc4c60..8aa1ce65 100644
--- a/externals/grill/py/scripts/sig.py
+++ b/externals/grill/py/scripts/sig.py
@@ -39,7 +39,10 @@ class gain(pyext._class):
def _signal(self):
# Multiply input vector by gain and copy to output
- self._outvec(0)[:] = self._invec(0)*self.gain
+ try:
+ self._outvec(0)[:] = self._invec(0)*self.gain
+ except:
+ pass
class gain2(pyext._class):
@@ -48,6 +51,10 @@ class gain2(pyext._class):
gain = 0
def _dsp(self):
+ if not self._arraysupport():
+ print "No DSP support"
+ return False
+
# cache vectors in this scope
self.invec = self._invec(0)
self.outvec = self._outvec(0)
@@ -56,6 +63,7 @@ class gain2(pyext._class):
self._signal = self.signal1
else:
self._signal = self.signal2
+ return True
def signal1(self):
# Multiply signal vector in place
@@ -78,6 +86,10 @@ class pan(pyext._class):
self.fl = math.cos(x)
self.fr = math.sin(x)
+ def _dsp(self):
+ # if _dsp is present it must return True to enable DSP
+ return pyext._arraysupport()
+
def _signal(self):
# Multiply input vector by gain and copy to output
iv = self._invec(0)
diff --git a/externals/grill/py/source/clmeth.cpp b/externals/grill/py/source/clmeth.cpp
index 267d2da9..3f856f57 100644
--- a/externals/grill/py/source/clmeth.cpp
+++ b/externals/grill/py/source/clmeth.cpp
@@ -80,7 +80,7 @@ PyObject* pyext::pyext__del__(PyObject *,PyObject *args)
PyObject* pyext::pyext_setattr(PyObject *,PyObject *args)
{
- PyObject *self,*name,*val,*ret = NULL;
+ PyObject *self,*name,*val;
if(!PyArg_ParseTuple(args, "OOO:test_foo", &self,&name,&val)) {
// handle error
ERRINTERNAL();
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 608ecdd7..fadb0173 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -160,10 +160,11 @@ FLEXT_LIB_SETUP(py,pybase::lib_setup)
pybase::pybase()
- : module(NULL),detach(0)
+ : module(NULL)
#ifdef FLEXT_THREADS
, shouldexit(false),thrcount(0),stoptick(0)
#endif
+ , detach(0)
{
PyThreadState *state = PyLockSys();
Py_INCREF(module_obj);
@@ -244,7 +245,7 @@ void pybase::m__doc(PyObject *obj)
}
else {
// copy string before newline to temp buffer and post
- int l = nl-s;
+ unsigned int l = nl-s;
if(l >= sizeof(buf)) l = sizeof buf-1;
strncpy(buf,s,l); // copy all but newline
buf[l] = 0;
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index 538e577d..b828f47b 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -107,6 +107,7 @@ protected:
static PyObject *py_priority(PyObject *,PyObject *args);
#endif
+ static PyObject *py_arraysupport(PyObject *,PyObject *args);
static PyObject *py_samplerate(PyObject *,PyObject *args);
static PyObject *py_blocksize(PyObject *,PyObject *args);
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp
index 983176bf..33f0fc7b 100644
--- a/externals/grill/py/source/modmeth.cpp
+++ b/externals/grill/py/source/modmeth.cpp
@@ -19,6 +19,7 @@ PyMethodDef pybase::func_tbl[] =
{ "_priority", pybase::py_priority, METH_VARARGS,"Set priority of current thread" },
#endif
+ { "_arraysupport", pybase::py_arraysupport, METH_NOARGS,"Query Python array support" },
{ "_samplerate", pybase::py_samplerate, METH_NOARGS,"Get system sample rate" },
{ "_blocksize", pybase::py_blocksize, METH_NOARGS,"Get system block size" },
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index 44d7a608..93309b37 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -122,7 +122,7 @@ void pyobj::Setup(t_classid c)
}
pyobj::pyobj(int argc,const t_atom *argv):
- function(NULL),funname(NULL),withfunction(false)
+ funname(NULL),function(NULL),withfunction(false)
{
AddInAnything(2);
AddOutAnything();
diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp
index 42e23557..0893b983 100644
--- a/externals/grill/py/source/pybuffer.cpp
+++ b/externals/grill/py/source/pybuffer.cpp
@@ -15,43 +15,47 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#if defined(PY_NUMERIC)
#define PY_ARRAYS 1
-
- #if FLEXT_OS == FLEXT_OS_MAC
- #include <Python/Numeric/arrayobject.h>
- #else
- #include <Numeric/arrayobject.h>
- #endif
#elif defined(PY_NUMARRAY)
#define PY_ARRAYS 1
#define NA
+#endif
+
+#ifdef PY_ARRAYS
#ifdef NA
#if FLEXT_OS == FLEXT_OS_MAC
- #include <Python/numarray/numarray.h>
+ #include <Python/numarray/libnumarray.h>
#else
- #include <numarray/numarray.h>
+ #include <numarray/libnumarray.h>
#endif
+
+static NumarrayType numtype = tAny;
+inline bool arrsupport() { return numtype != tAny; }
+
#else
#if FLEXT_OS == FLEXT_OS_MAC
#include <Python/numarray/arrayobject.h>
#else
#include <numarray/arrayobject.h>
#endif
+
+static PyArray_TYPES numtype = PyArray_NOTYPE;
+inline bool arrsupport() { return numtype != PyArray_NOTYPE; }
#endif
#endif
+PyObject *pybase::py_arraysupport(PyObject *self,PyObject *args)
+{
+ PyObject *ret;
#ifdef PY_ARRAYS
-
-#ifdef NA
-static NumarrayType numtype = tAny;
-inline bool arrsupport() { return numtype != tAny; }
+ ret = Py_True;
#else
-static PyArray_TYPES numtype = PyArray_NOTYPE;
-inline bool arrsupport() { return numtype != PyArray_NOTYPE; }
-#endif
-
+ ret = Py_False;
#endif
+ Py_INCREF(ret);
+ return ret;
+}
// PD defines a T_OBJECT symbol
@@ -408,13 +412,13 @@ static PyObject *buffer_repeat(pySamplebuffer *self,int rep)
static PySequenceMethods buffer_as_seq = {
- (inquiry)buffer_length, /* inquiry sq_length; /* __len__ */
+ (inquiry)buffer_length, /* inquiry sq_length; __len__ */
(binaryfunc)buffer_concat, /* __add__ */
(intargfunc)buffer_repeat, /* __mul__ */
- (intargfunc)buffer_item, /* intargfunc sq_item; /* __getitem__ */
- (intintargfunc)buffer_slice, /* intintargfunc sq_slice; /* __getslice__ */
- (intobjargproc)buffer_ass_item, /* intobjargproc sq_ass_item; /* __setitem__ */
- (intintobjargproc)buffer_ass_slice, /* intintobjargproc sq_ass_slice; /* __setslice__ */
+ (intargfunc)buffer_item, /* intargfunc sq_item; __getitem__ */
+ (intintargfunc)buffer_slice, /* intintargfunc sq_slice; __getslice__ */
+ (intobjargproc)buffer_ass_item, /* intobjargproc sq_ass_item; __setitem__ */
+ (intintobjargproc)buffer_ass_slice, /* intintobjargproc sq_ass_slice; __setslice__ */
};
static PyObject *buffer_iter(PyObject *obj)
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;
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 2fd0ee22..eb58d1a0 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -97,7 +97,7 @@ void pyext::SetThis()
{
// remember the this pointer
PyObject *th = PyLong_FromVoidPtr(this);
- int ret = PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
+ /*int ret =*/ PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
}
@@ -105,10 +105,11 @@ PyObject *pyext::class_obj = NULL;
PyObject *pyext::class_dict = NULL;
pyext::pyext(int argc,const t_atom *argv,bool sig):
- pyobj(NULL),pythr(NULL),
+ methname(NULL),
+ pyobj(NULL),
inlets(-1),outlets(-1),
siginlets(0),sigoutlets(0),
- methname(NULL)
+ pythr(NULL)
{
#ifdef FLEXT_THREADS
FLEXT_ADDTIMER(stoptmr,tick);