aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-06-04 02:38:08 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-06-04 02:38:08 +0000
commita6d4aa2bcc49633db1d8464f7727cb73e2c0d052 (patch)
treedd3bc68f69d188f32d18022cf5d773a8f201079e /externals
parent3fb9132261bbc69087161c0f80a3be10a60f07a9 (diff)
""
svn path=/trunk/; revision=681
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/flext/changes.txt3
-rw-r--r--externals/grill/flext/flext_sh.dsp8
-rw-r--r--externals/grill/flext/source/flext.h4
-rwxr-xr-xexternals/grill/flext/source/flsimd.cpp301
-rw-r--r--externals/grill/flext/source/flsupport.h5
-rw-r--r--externals/grill/py/source/bound.cpp68
-rw-r--r--externals/grill/py/source/pyext.cpp2
-rw-r--r--externals/grill/py/source/pyext.h13
-rw-r--r--externals/grill/vasp/pd-ex/freeze1.pd144
-rw-r--r--externals/grill/vasp/pd/vasp.opt.pd8
-rw-r--r--externals/grill/xsample/source/main.cpp12
-rw-r--r--externals/grill/xsample/source/main.h8
12 files changed, 422 insertions, 154 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index 6ef61b98..4125fc05 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -13,6 +13,9 @@ Donations for further development of the package are highly appreciated.
Version history:
+0.5.0:
+- added some more SIMD functions
+
0.4.4:
- fixed deadly bug for Max/MSP method-to-symbol-binding proxies
- some fixes for CodeWarrior Mach-O compilation
diff --git a/externals/grill/flext/flext_sh.dsp b/externals/grill/flext/flext_sh.dsp
index 35c604b6..dad184c8 100644
--- a/externals/grill/flext/flext_sh.dsp
+++ b/externals/grill/flext/flext_sh.dsp
@@ -40,7 +40,7 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "pd-msvc/dr"
+# PROP Output_Dir "pd-msvc"
# PROP Intermediate_Dir "pd-msvc/dr"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
@@ -67,7 +67,7 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "pd-msvc/dd"
+# PROP Output_Dir "pd-msvc"
# PROP Intermediate_Dir "pd-msvc/dd"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "pd-msvc\ddl"
+# PROP Output_Dir "pd-msvc"
# PROP Intermediate_Dir "pd-msvc\ddl"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
@@ -121,7 +121,7 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "pd-msvc\drl"
+# PROP Output_Dir "pd-msvc"
# PROP Intermediate_Dir "pd-msvc\drl"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h
index 7472e4a1..1a87e2bf 100644
--- a/externals/grill/flext/source/flext.h
+++ b/externals/grill/flext/source/flext.h
@@ -23,10 +23,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
//! \brief flext version number
-#define FLEXT_VERSION 404
+#define FLEXT_VERSION 500
//! \brief flext version string
-#define FLEXT_VERSTR "0.4.4"
+#define FLEXT_VERSTR "0.5.0pre"
//! @}
diff --git a/externals/grill/flext/source/flsimd.cpp b/externals/grill/flext/source/flsimd.cpp
index 9786e4e7..a491bd51 100755
--- a/externals/grill/flext/source/flsimd.cpp
+++ b/externals/grill/flext/source/flsimd.cpp
@@ -284,15 +284,14 @@ void flext::CopySamples(t_sample *dst,const t_sample *src,int cnt)
#else
#ifdef FLEXT_USE_SIMD
#ifdef _MSC_VER
-#if 1 // t_sample is float
if(GetSIMDCapabilities()&simd_sse) {
// single precision
int n = cnt>>4;
cnt -= n<<4;
- if((reinterpret_cast<unsigned long>(src)&(__alignof(t_sample)-1)) == 0
- && (reinterpret_cast<unsigned long>(dst)&(__alignof(t_sample)-1)) == 0
+ if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
+ && (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
) {
// aligned version
while(n--) {
@@ -316,41 +315,6 @@ void flext::CopySamples(t_sample *dst,const t_sample *src,int cnt)
while(cnt--) *(dst++) = *(src++);
}
else
-#elif 0 // t_sample is double
- if(GetSIMDCapabilities()&simd_sse2) {
- // double precision
-
- int n = cnt>>3;
- cnt -= n<<3;
-
- if((reinterpret_cast<unsigned long>(src)&(__alignof(t_sample)-1)) == 0
- && (reinterpret_cast<unsigned long>(dst)&(__alignof(t_sample)-1)) == 0
- ) {
- // aligned version
- while(n--) {
- _mm_store_pd(dst+0,_mm_load_pd(src+0));
- _mm_store_pd(dst+2,_mm_load_pd(src+2));
- _mm_store_pd(dst+4,_mm_load_pd(src+4));
- _mm_store_pd(dst+6,_mm_load_pd(src+6));
- src += 8,dst += 8;
- }
- }
- else {
- // unaligned version
- while(n--) {
- _mm_storeu_pd(dst+0,_mm_loadu_pd(src+0));
- _mm_storeu_pd(dst+2,_mm_loadu_pd(src+2));
- _mm_storeu_pd(dst+4,_mm_loadu_pd(src+4));
- _mm_storeu_pd(dst+6,_mm_loadu_pd(src+6));
- src += 8,dst += 8;
- }
- }
- while(cnt--) *(dst++) = *(src++);
- }
- else
-#else
- #error t_sample data type has illegal size
-#endif
#elif FLEXT_OS == FLEXT_OS_MAC && defined(__VEC__) && defined(__VECTOROPS__)
{
int n = cnt>>2,n4 = n<<2;
@@ -388,7 +352,6 @@ void flext::SetSamples(t_sample *dst,int cnt,t_sample s)
#else
#ifdef FLEXT_USE_SIMD
#ifdef _MSC_VER
-#if 1 // t_sample is float
if(GetSIMDCapabilities()&simd_sse) {
// single precision
@@ -396,7 +359,7 @@ void flext::SetSamples(t_sample *dst,int cnt,t_sample s)
int n = cnt>>4;
cnt -= n<<4;
- if((reinterpret_cast<unsigned long>(dst)&(__alignof(t_sample)-1)) == 0) {
+ if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
// aligned version
while(n--) {
_mm_store_ps(dst+0,v);
@@ -419,51 +382,261 @@ void flext::SetSamples(t_sample *dst,int cnt,t_sample s)
while(cnt--) *(dst++) = s;
}
else
-#elif 0 // t_sample is double
- if(GetSIMDCapabilities()&simd_sse2) {
- // double precision
+#endif // _MSC_VER
+#endif // FLEXT_USE_SIMD
+ {
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s;
+ dst += 8;
+ }
+
+ while(cnt--) *(dst++) = s;
+ }
+#endif
+}
+
+
+void flext::MulSamples(t_sample *dst,const t_sample *src,t_sample mul,int cnt)
+{
+#ifdef FLEXT_USE_IPP
+ if(sizeof(t_sample) == 4) {
+ ippsCopy_32f((const float *)src,(float *)dst,cnt);
+ ippsMulC_32f_I((float)mul,(float *)dst,cnt);
+ }
+ else if(sizeof(t_sample) == 8) {
+ ippsCopy_64f((const double *)src,(double *)dst,cnt);
+ ippsMulC_64f_I((double)mul,(double *)dst,cnt);
+ }
+ else
+ ERRINTERNAL();
+#else
+#ifdef FLEXT_USE_SIMD
+#ifdef _MSC_VER
+ if(GetSIMDCapabilities()&simd_sse) {
+ // single precision
+ __m128 a = _mm_load1_ps(&mul);
- __m128 v = _mm_load1_pd(&s);
- int n = cnt>>3;
- cnt -= n<<3;
+ int n = cnt>>4;
+ cnt -= n<<4;
- if((reinterpret_cast<unsigned long>(dst)&(__alignof(t_sample)-1)) == 0) {
+ if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
+ && (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
+ ) {
// aligned version
- while(n--) {
- _mm_store_pd(dst+0,v);
- _mm_store_pd(dst+2,v);
- _mm_store_pd(dst+4,v);
- _mm_store_pd(dst+8,v);
- dst += 8;
+ while(n--) {
+ _mm_store_ps(dst+0,_mm_mul_ps(a,_mm_load_ps(src+0)));
+ _mm_store_ps(dst+4,_mm_mul_ps(a,_mm_load_ps(src+4)));
+ _mm_store_ps(dst+8,_mm_mul_ps(a,_mm_load_ps(src+8)));
+ _mm_store_ps(dst+12,_mm_mul_ps(a,_mm_load_ps(src+12)));
+ src += 16,dst += 16;
}
}
else {
// unaligned version
while(n--) {
- _mm_storeu_pd(dst+0,v);
- _mm_storeu_pd(dst+2,v);
- _mm_storeu_pd(dst+4,v);
- _mm_storeu_pd(dst+8,v);
- dst += 8;
+ _mm_storeu_ps(dst+0,_mm_mul_ps(a,_mm_loadu_ps(src+0)));
+ _mm_storeu_ps(dst+4,_mm_mul_ps(a,_mm_loadu_ps(src+4)));
+ _mm_storeu_ps(dst+8,_mm_mul_ps(a,_mm_loadu_ps(src+8)));
+ _mm_storeu_ps(dst+12,_mm_mul_ps(a,_mm_loadu_ps(src+12)));
+ src += 16,dst += 16;
}
}
- while(cnt--) *(dst++) = s;
+ while(cnt--) *(dst++) = *(src++)*mul;
}
else
+/*
+#elif FLEXT_OS == FLEXT_OS_MAC && defined(__VEC__) && defined(__VECTOROPS__)
+ {
+ int n = cnt>>2,n4 = n<<2;
+ cnt -= n4;
+ vScopy(n4,src,dst);
+ src += n4,dst += n4;
+ while(cnt--) *(dst++) = *(src++);
+ }
+*/
+#endif // _MSC_VER
+#endif // FLEXT_USE_SIMD
+ {
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = src[0]*mul;
+ dst[1] = src[1]*mul;
+ dst[2] = src[2]*mul;
+ dst[3] = src[3]*mul;
+ dst[4] = src[4]*mul;
+ dst[5] = src[5]*mul;
+ dst[6] = src[6]*mul;
+ dst[7] = src[7]*mul;
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++)*mul;
+ }
+#endif
+}
+
+
+void flext::AddSamples(t_sample *dst,const t_sample *src,t_sample add,int cnt)
+{
+#ifdef FLEXT_USE_IPP
+ if(sizeof(t_sample) == 4) {
+ ippsCopy_32f((const float *)src,(float *)dst,cnt);
+ ippsAddC_32f_I((float)mul,(float *)dst,cnt);
+ }
+ else if(sizeof(t_sample) == 8) {
+ ippsCopy_64f((const double *)src,(double *)dst,cnt);
+ ippsAddC_64f_I((double)mul,(double *)dst,cnt);
+ }
+ else
+ ERRINTERNAL();
#else
- #error t_sample data type has illegal size
+#ifdef FLEXT_USE_SIMD
+#ifdef _MSC_VER
+ if(GetSIMDCapabilities()&simd_sse) {
+ // single precision
+ __m128 a = _mm_load1_ps(&add);
+
+ int n = cnt>>4;
+ cnt -= n<<4;
+
+ if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
+ && (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
+ ) {
+ // aligned version
+ while(n--) {
+ _mm_store_ps(dst+0,_mm_add_ps(a,_mm_load_ps(src+0)));
+ _mm_store_ps(dst+4,_mm_add_ps(a,_mm_load_ps(src+4)));
+ _mm_store_ps(dst+8,_mm_add_ps(a,_mm_load_ps(src+8)));
+ _mm_store_ps(dst+12,_mm_add_ps(a,_mm_load_ps(src+12)));
+ src += 16,dst += 16;
+ }
+ }
+ else {
+ // unaligned version
+ while(n--) {
+ _mm_storeu_ps(dst+0,_mm_add_ps(a,_mm_loadu_ps(src+0)));
+ _mm_storeu_ps(dst+4,_mm_add_ps(a,_mm_loadu_ps(src+4)));
+ _mm_storeu_ps(dst+8,_mm_add_ps(a,_mm_loadu_ps(src+8)));
+ _mm_storeu_ps(dst+12,_mm_add_ps(a,_mm_loadu_ps(src+12)));
+ src += 16,dst += 16;
+ }
+ }
+ while(cnt--) *(dst++) = *(src++)+add;
+ }
+ else
+/*
+#elif FLEXT_OS == FLEXT_OS_MAC && defined(__VEC__) && defined(__VECTOROPS__)
+ {
+ int n = cnt>>2,n4 = n<<2;
+ cnt -= n4;
+ vScopy(n4,src,dst);
+ src += n4,dst += n4;
+ while(cnt--) *(dst++) = *(src++);
+ }
+*/
+#endif // _MSC_VER
+#endif // FLEXT_USE_SIMD
+ {
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = src[0]+add;
+ dst[1] = src[1]+add;
+ dst[2] = src[2]+add;
+ dst[3] = src[3]+add;
+ dst[4] = src[4]+add;
+ dst[5] = src[5]+add;
+ dst[6] = src[6]+add;
+ dst[7] = src[7]+add;
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++)+add;
+ }
#endif
+}
+
+
+void flext::ScaleSamples(t_sample *dst,const t_sample *src,t_sample mul,t_sample add,int cnt)
+{
+#ifdef FLEXT_USE_IPP
+ if(sizeof(t_sample) == 4) {
+ ippsCopy_32f((const float *)src,(float *)dst,cnt);
+ ippsMulC_32f_I((float)mul,(float *)dst,cnt);
+ ippsAddC_32f_I((float)add,(float *)dst,cnt);
+ }
+ else if(sizeof(t_sample) == 8) {
+ ippsCopy_64f((const double *)src,(double *)dst,cnt);
+ ippsMulC_64f_I((double)mul,(double *)dst,cnt);
+ ippsAddC_64f_I((double)add,(double *)dst,cnt);
+ }
+ else
+ ERRINTERNAL();
+#else
+#ifdef FLEXT_USE_SIMD
+#ifdef _MSC_VER
+ if(GetSIMDCapabilities()&simd_sse) {
+ // single precision
+ __m128 a = _mm_load1_ps(&add);
+ __m128 m = _mm_load1_ps(&mul);
+
+ int n = cnt>>4;
+ cnt -= n<<4;
+
+ if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
+ && (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
+ ) {
+ // aligned version
+ while(n--) {
+ _mm_store_ps(dst+0,_mm_add_ps(a,_mm_mul_ps(m,_mm_load_ps(src+0))));
+ _mm_store_ps(dst+4,_mm_add_ps(a,_mm_mul_ps(m,_mm_load_ps(src+4))));
+ _mm_store_ps(dst+8,_mm_add_ps(a,_mm_mul_ps(m,_mm_load_ps(src+8))));
+ _mm_store_ps(dst+12,_mm_add_ps(a,_mm_mul_ps(m,_mm_load_ps(src+12))));
+ src += 16,dst += 16;
+ }
+ }
+ else {
+ // unaligned version
+ while(n--) {
+ _mm_storeu_ps(dst+0,_mm_add_ps(a,_mm_mul_ps(m,_mm_loadu_ps(src+0))));
+ _mm_storeu_ps(dst+4,_mm_add_ps(a,_mm_mul_ps(m,_mm_loadu_ps(src+4))));
+ _mm_storeu_ps(dst+8,_mm_add_ps(a,_mm_mul_ps(m,_mm_loadu_ps(src+8))));
+ _mm_storeu_ps(dst+12,_mm_add_ps(a,_mm_mul_ps(m,_mm_loadu_ps(src+12))));
+ src += 16,dst += 16;
+ }
+ }
+ while(cnt--) *(dst++) = *(src++)*mul+add;
+ }
+ else
+/*
+#elif FLEXT_OS == FLEXT_OS_MAC && defined(__VEC__) && defined(__VECTOROPS__)
+ {
+ int n = cnt>>2,n4 = n<<2;
+ cnt -= n4;
+ vScopy(n4,src,dst);
+ src += n4,dst += n4;
+ while(cnt--) *(dst++) = *(src++);
+ }
+*/
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
int n = cnt>>3;
cnt -= n<<3;
while(n--) {
- dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s;
- dst += 8;
+ dst[0] = src[0]*mul+add;
+ dst[1] = src[1]*mul+add;
+ dst[2] = src[2]*mul+add;
+ dst[3] = src[3]*mul+add;
+ dst[4] = src[4]*mul+add;
+ dst[5] = src[5]*mul+add;
+ dst[6] = src[6]*mul+add;
+ dst[7] = src[7]*mul+add;
+ src += 8,dst += 8;
}
-
- while(cnt--) *(dst++) = s;
+ while(cnt--) *(dst++) = *(src++)*mul+add;
}
#endif
}
+
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 2235e854..fef7e16a 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -959,6 +959,11 @@ public:
static unsigned long GetSIMDCapabilities();
+
+ static void MulSamples(t_sample *dst,const t_sample *src,t_sample mul,int cnt);
+ static void AddSamples(t_sample *dst,const t_sample *src,t_sample add,int cnt);
+ static void ScaleSamples(t_sample *dst,const t_sample *src,t_sample mul,t_sample add,int cnt);
+
//! @} FLEXT_S_SIMD
diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp
index 58250830..e8e2599f 100644
--- a/externals/grill/py/source/bound.cpp
+++ b/externals/grill/py/source/bound.cpp
@@ -11,6 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "pyext.h"
#include "flinternal.h"
+#ifndef USEFLEXTBINDING
t_class *pyext::px_class;
pyext::py_proxy *pyext::px_head,*pyext::px_tail;
@@ -28,6 +29,26 @@ void pyext::py_proxy::px_method(py_proxy *obj,const t_symbol *s,int argc,const t
PY_UNLOCK
}
+#else
+struct bounddata { PyObject *self,*func; };
+
+bool pyext::boundmeth(flext_base *,const t_symbol *sym,int argc,const t_atom *argv,void *data)
+{
+ bounddata *obj = (bounddata *)data;
+
+ PY_LOCK
+
+ PyObject *args = MakePyArgs(sym,AtomList(argc,argv),-1,obj->self != NULL);
+ PyObject *ret = PyObject_CallObject(obj->func,args);
+ if(!ret) {
+ PyErr_Print();
+ }
+ Py_XDECREF(ret);
+
+ PY_UNLOCK
+ return true;
+}
+#endif
PyObject *pyext::pyext_bind(PyObject *,PyObject *args)
{
@@ -39,18 +60,20 @@ PyObject *pyext::pyext_bind(PyObject *,PyObject *args)
post("py/pyext - Wrong argument types!");
}
else {
- t_symbol *recv = gensym(name);
+ const t_symbol *recv = MakeSymbol(name);
/*
if(GetBound(recv))
post("py/pyext - Symbol \"%s\" is already hooked",GetString(recv));
*/
// make a proxy object
- py_proxy *px = (py_proxy *)object_new(px_class);
+
if(PyMethod_Check(meth)) {
PyObject *no = PyObject_GetAttrString(meth,"__name__");
meth = PyObject_GetAttr(self,no);
Py_DECREF(no);
}
+#ifndef USEFLEXTBINDING
+ py_proxy *px = (py_proxy *)object_new(px_class);
px->init(recv,self,meth);
// add it to the list
@@ -59,7 +82,13 @@ PyObject *pyext::pyext_bind(PyObject *,PyObject *args)
px_tail = px;
// Do bind
- pd_bind(&px->obj.ob_pd,recv);
+ pd_bind(&px->obj.ob_pd,(t_symbol *)recv);
+#else
+ bounddata *data = new bounddata;
+ data->self = self;
+ data->func = meth;
+ GetThis(self)->BindMethod(recv,boundmeth,data);
+#endif
Py_INCREF(self); // self is borrowed reference
}
@@ -78,13 +107,14 @@ PyObject *pyext::pyext_unbind(PyObject *,PyObject *args)
post("py/pyext - Wrong argument types!");
}
else {
- t_symbol *recv = gensym(name);
+ const t_symbol *recv = MakeSymbol(name);
if(PyMethod_Check(meth)) {
PyObject *no = PyObject_GetAttrString(meth,"__name__");
meth = PyObject_GetAttr(self,no); // meth is given a new reference!
Py_DECREF(no);
}
+#ifndef USEFLEXTBINDING
// search proxy object
py_proxy *pp = NULL,*px = px_head;
while(px) {
@@ -103,12 +133,23 @@ PyObject *pyext::pyext_unbind(PyObject *,PyObject *args)
// do unbind
if(px) {
- pd_unbind(&px->obj.ob_pd,recv);
+ pd_unbind(&px->obj.ob_pd,(t_symbol *)recv);
object_free(&px->obj);
Py_DECREF(self);
if(PyMethod_Check(meth)) Py_DECREF(meth);
}
+#else
+ void *data = NULL;
+ if(GetThis(self)->UnbindMethod(recv,boundmeth,&data)) {
+ bounddata *bdt = (bounddata *)data;
+ if(bdt) {
+ Py_DECREF(bdt->self);
+ if(PyMethod_Check(bdt->func)) Py_DECREF(bdt->func);
+ if(data) delete bdt;
+ }
+ }
+#endif
}
Py_INCREF(Py_None);
@@ -118,6 +159,7 @@ PyObject *pyext::pyext_unbind(PyObject *,PyObject *args)
V pyext::ClearBinding()
{
+#ifndef USEFLEXTBINDING
// search proxy object
py_proxy *pp = NULL,*px = px_head;
while(px) {
@@ -132,12 +174,26 @@ V pyext::ClearBinding()
Py_DECREF(px->self);
if(PyMethod_Check(px->func)) Py_DECREF(px->func);
- pd_unbind(&px->obj.ob_pd,px->name);
+ pd_unbind(&px->obj.ob_pd,(t_symbol *)px->name);
object_free(&px->obj);
}
else pp = px;
px = pn;
}
+#else
+ void *data = NULL;
+ const t_symbol *sym = NULL;
+
+ // unbind all
+ while(GetThis(pyobj)->UnbindMethod(sym,NULL,&data)) {
+ bounddata *bdt = (bounddata *)data;
+ if(bdt) {
+ Py_DECREF(bdt->self);
+ if(PyMethod_Check(bdt->func)) Py_DECREF(bdt->func);
+ if(data) delete bdt;
+ }
+ }
+#endif
}
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 5f984b4b..ddd9fda6 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -16,10 +16,12 @@ FLEXT_LIB_V("pyext",pyext)
V pyext::Setup(t_classid c)
{
+#ifndef USEFLEXTBINDING
px_head = px_tail = NULL;
px_class = class_new(gensym("pyext proxy"),NULL,NULL,sizeof(py_proxy),CLASS_PD|CLASS_NOINLET, A_NULL);
::add_anything(px_class,py_proxy::px_method); // for other inlets
+#endif
FLEXT_CADDMETHOD_(c,0,"reload.",m_reload);
FLEXT_CADDMETHOD_(c,0,"reload",m_reload_);
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index 60601555..8f9a1b1b 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -70,6 +70,7 @@ private:
// -------- bound stuff ------------------
+#ifndef USEFLEXTBINDING
static t_class *px_class;
friend class py_proxy;
@@ -79,11 +80,11 @@ private:
public:
t_object obj; // MUST reside at memory offset 0
PyObject *self,*func;
- t_symbol *name;
+ const t_symbol *name;
py_proxy *nxt;
- void init(t_symbol *n,PyObject *s,PyObject *f) { name = n,self = s,func = f,nxt = NULL; }
+ void init(const t_symbol *n,PyObject *s,PyObject *f) { name = n,self = s,func = f,nxt = NULL; }
// bool cmp(PyObject *s,PyObject *f) const { return self == s && func == f; }
// void init(PyObject *s,char *f) { self = s,func = f,nxt = NULL; }
// bool cmp(PyObject *s,char *f) const { return self == s && func == f; }
@@ -93,6 +94,10 @@ private:
static PyObject *pyext_bind(PyObject *,PyObject *args);
static PyObject *pyext_unbind(PyObject *,PyObject *args);
+#else
+ static PyObject *pyext_bind(PyObject *,PyObject *args);
+ static PyObject *pyext_unbind(PyObject *,PyObject *args);
+#endif
// ---------------------------
@@ -118,7 +123,9 @@ private:
PyThreadState *pythr;
private:
- FLEXT_CALLBACK(m_reload)
+ static bool boundmeth(flext_base *,const t_symbol *sym,int argc,const t_atom *argv,void *data);
+
+ FLEXT_CALLBACK(m_reload)
FLEXT_CALLBACK_V(m_reload_)
FLEXT_CALLBACK(m_doc_)
};
diff --git a/externals/grill/vasp/pd-ex/freeze1.pd b/externals/grill/vasp/pd-ex/freeze1.pd
index 0e1cbd7d..c7a43f8e 100644
--- a/externals/grill/vasp/pd-ex/freeze1.pd
+++ b/externals/grill/vasp/pd-ex/freeze1.pd
@@ -1,43 +1,47 @@
-#N canvas 33 61 977 513 12;
-#N canvas 387 42 569 658 freeze 0;
+#N canvas 14 73 985 521 12;
+#N canvas 387 42 591 680 freeze 0;
#X obj 26 130 vasp.split 2;
-#X obj 27 404 vasp.join 2;
+#X obj 30 459 vasp.join 2;
#X obj 27 74 vasp.cfft @detach 1;
-#X obj 27 461 vasp.c!fft @detach 1;
+#X obj 30 516 vasp.c!fft @detach 1;
#X obj 25 13 inlet;
-#X obj 27 589 outlet;
-#X obj 173 236 * 0.01;
+#X obj 32 617 outlet;
+#X obj 91 230 * 0.01;
#X obj 302 17 inlet;
#X obj 26 100 vasp.polar @detach 1;
-#X obj 27 432 vasp.rect @detach 1;
-#X obj 26 261 vasp.gate @detach 1;
-#X obj 92 319 vasp.noise @detach 1;
-#X obj 26 371 vasp.sync;
-#X obj 25 209 vasp.max? @detach 1;
+#X obj 30 487 vasp.rect @detach 1;
+#X obj 29 316 vasp.gate @detach 1;
+#X obj 95 374 vasp.noise @detach 1;
+#X obj 29 426 vasp.sync;
+#X obj 91 208 vasp.max? @detach 1;
#X obj 381 17 inlet;
-#X obj 162 591 outlet;
-#X obj 29 536 vasp.opt;
-#N canvas 238 212 458 308 non0 0;
-#X obj 58 187 outlet;
+#X obj 167 619 outlet;
+#X obj 32 591 vasp.opt;
+#N canvas 238 212 466 316 non0 0;
+#X obj 58 254 outlet;
#X obj 60 158 / 1;
#X obj 26 21 inlet;
#X obj 26 49 t a a;
#X obj 234 77 vasp.f?;
#X obj 26 80 vasp.!= 0 @detach 1;
#X obj 27 109 vasp.sum?;
-#X connect 1 0 0 0;
+#X obj 60 195 rmstodb;
+#X obj 60 225 - 100;
+#X connect 1 0 7 0;
#X connect 2 0 3 0;
#X connect 3 0 5 0;
#X connect 3 1 4 0;
#X connect 4 0 1 1;
#X connect 5 0 6 0;
#X connect 6 1 1 0;
-#X restore 161 498 pd non0;
-#X obj 29 509 vasp.n 0;
+#X connect 7 0 8 0;
+#X connect 8 0 0 0;
+#X restore 164 553 pd non0;
+#X obj 32 564 vasp.n 0;
#X obj 302 45 + 100;
#X obj 326 117 expr pow(2. \, -$f1/1200);
#X obj 300 76 dbtorms;
-#N canvas 445 282 476 326 cplx 0;
+#N canvas 445 282 478 328 cplx 0;
#X obj 19 229 vasp.join;
#X obj 19 73 t a b a;
#X obj 149 137 vasp.f?;
@@ -59,32 +63,35 @@
#X connect 10 0 0 0;
#X connect 10 1 0 1;
#X restore 27 43 pd cplx;
-#X text 280 169 resample;
-#X text 185 211 find spectral peak;
-#X text 188 260 gate spectrum below threshold;
-#X text 107 371 wait for threads to finish;
-#X obj 92 344 vasp.* 3.14159 @detach 1;
+#X text 280 159 resample;
+#X text 146 230 find spectral peak;
+#X text 191 315 gate spectrum below threshold;
+#X text 110 426 wait for threads to finish;
+#X obj 95 399 vasp.* 3.14159 @detach 1;
#X text 193 75 FFT;
#X text 195 100 -> polar;
-#X text 188 432 -> cartesian;
-#X text 198 460 inverse FFT;
-#X text 263 316 randomize complex arguments;
-#X text 225 496 get spectral density;
-#X obj 25 171 vasp.xtilt 1 @detach 1 @inter 2;
-#X obj 27 290 vasp.pow @detach 1;
+#X text 191 487 -> cartesian;
+#X text 201 515 inverse FFT;
+#X text 266 371 randomize complex arguments;
+#X text 228 551 get spectral density;
+#X obj 25 156 vasp.xtilt 1 @detach 1 @inter 2;
+#X obj 30 345 vasp.pow @detach 1;
#X obj 441 21 inlet;
-#X text 181 289 treat spectrum exponentially;
-#X obj 395 389 loadbang;
-#X msg 395 414 detach 1;
-#X text 102 536 normalize result;
-#X text 388 435 no attributes yet;
+#X text 184 344 treat spectrum exponentially;
+#X obj 398 444 loadbang;
+#X msg 398 469 detach 1;
+#X text 105 591 normalize result;
+#X text 391 490 no attributes yet;
+#X obj 26 179 t a a;
+#X obj 28 288 vasp;
+#X obj 89 257 t b f;
#X connect 0 0 34 0;
#X connect 0 1 11 0;
#X connect 1 0 9 0;
#X connect 2 0 8 0;
#X connect 3 0 18 0;
#X connect 4 0 22 0;
-#X connect 6 0 10 1;
+#X connect 6 0 44 0;
#X connect 7 0 19 0;
#X connect 8 0 0 0;
#X connect 9 0 3 0;
@@ -93,8 +100,7 @@
#X connect 12 0 1 0;
#X connect 12 0 17 0;
#X connect 12 1 1 1;
-#X connect 13 0 10 0;
-#X connect 13 1 6 0;
+#X connect 13 0 6 0;
#X connect 14 0 20 0;
#X connect 16 0 5 0;
#X connect 17 0 15 0;
@@ -104,14 +110,19 @@
#X connect 21 0 6 1;
#X connect 22 0 2 0;
#X connect 27 0 12 1;
-#X connect 34 0 13 0;
+#X connect 34 0 42 0;
#X connect 35 0 12 0;
#X connect 36 0 35 1;
#X connect 38 0 39 0;
#X connect 39 0 16 0;
+#X connect 42 0 13 0;
+#X connect 42 1 43 1;
+#X connect 43 0 10 0;
+#X connect 44 0 43 0;
+#X connect 44 1 10 1;
#X restore 18 331 pd freeze;
#X obj 104 214 nbx 6 18 -100 0 0 1 empty empty noise_rejection(dB)
-0 -8 0 12 -225271 -1 -1 -61 256;
+0 -8 0 12 -225271 -1 -1 -13 256;
#X obj 104 257 nbx 7 18 -10000 10000 0 1 empty empty transpose(cents)
0 -8 0 12 -225271 -1 -1 0 256;
#X obj 448 278 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
@@ -138,13 +149,12 @@
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 729 250 pd save;
-#N canvas 205 58 331 468 open 0;
+#N canvas 205 58 335 472 open 0;
#X obj 18 192 soundfiler;
#X obj 19 96 openpanel;
#X obj 21 6 inlet;
#X obj 15 390 outlet;
#X obj 20 123 symbol;
-#X obj 15 313 vasp.opt;
#X obj 17 345 vasp.u;
#X obj 17 233 t b;
#X obj 22 33 route new again;
@@ -153,25 +163,26 @@
#X msg 19 152 read -resize \$1 src;
#X msg 16 281 vasp src;
#X obj 74 230 s \$0-srclen;
-#X connect 0 0 7 0;
-#X connect 0 0 13 0;
+#X obj 15 313 vasp.opt;
+#X connect 0 0 6 0;
+#X connect 0 0 12 0;
#X connect 1 0 4 0;
-#X connect 2 0 8 0;
-#X connect 4 0 11 0;
-#X connect 5 0 6 0;
-#X connect 6 0 3 0;
-#X connect 7 0 12 0;
-#X connect 8 0 9 0;
-#X connect 8 1 10 0;
-#X connect 9 0 1 0;
-#X connect 10 0 4 0;
-#X connect 11 0 0 0;
-#X connect 12 0 5 0;
+#X connect 2 0 7 0;
+#X connect 4 0 10 0;
+#X connect 5 0 3 0;
+#X connect 6 0 11 0;
+#X connect 7 0 8 0;
+#X connect 7 1 9 0;
+#X connect 8 0 1 0;
+#X connect 9 0 4 0;
+#X connect 10 0 0 0;
+#X connect 11 0 13 0;
+#X connect 13 0 5 0;
#X restore 448 250 pd open;
#X msg 381 222 stop;
#N canvas 0 0 450 300 graph10 0;
-#X array src 1e+006 float 0;
-#X coords 0 1 999999 -1 600 150 1;
+#X array src 4e+006 float 0;
+#X coords 0 1 4e+006 -1 600 150 1;
#X restore 322 20 graph;
#X msg 447 222 new;
#X msg 482 222 again;
@@ -184,9 +195,9 @@
#X obj 18 108 bng 25 250 50 0 empty empty empty 0 -6 0 8 -24198 -1
-1;
#X obj 105 115 nbx 12 18 0 1e+008 0 1 empty empty length(frames) 0
--8 0 12 -225271 -1 -1 1e+006 256;
+-8 0 12 -225271 -1 -1 4e+006 256;
#X obj 85 368 nbx 9 14 -1e+037 1e+037 0 0 empty empty spectral_density
-0 -6 0 10 -262131 -1 -1 0 256;
+0 -6 0 10 -262131 -1 -1 0.00090725 256;
#X obj 332 197 cnv 15 100 20 empty empty play_src 5 8 0 10 -261681
-66577 0;
#X obj 447 197 cnv 15 100 20 empty empty read_src 5 8 0 10 -261681
@@ -194,8 +205,8 @@
#X obj 727 197 cnv 15 100 20 empty empty write_dst 5 8 0 10 -261681
-66577 0;
#N canvas 0 0 450 300 graph10 0;
-#X array dst 1e+006 float 0;
-#X coords 0 1 999999 -1 600 150 1;
+#X array dst 4e+006 float 0;
+#X coords 0 1 4e+006 -1 600 150 1;
#X restore 325 304 graph;
#X msg 663 223 stop;
#X msg 614 223 play;
@@ -250,7 +261,7 @@
#X connect 3 0 0 1;
#X connect 3 1 4 0;
#X restore 614 251 pd playdst;
-#N canvas 249 202 529 472 copy 0;
+#N canvas 249 202 537 480 copy 0;
#X obj 27 26 inlet;
#X obj 27 51 t b b;
#X obj 316 19 inlet;
@@ -301,10 +312,10 @@
#X restore 18 159 pd copy;
#X text 85 160 copy and resize;
#X obj 323 170 hsl 600 15 0 1 0 1 \$0-r2 empty empty -2 -6 1152 8 -262131
--1 -1 59900 1;
+-1 -1 15700 1;
#X obj 323 5 hsl 600 15 0 1 0 1 \$0-r1 empty empty -2 -6 1152 8 -262131
--1 -1 0 1;
-#N canvas 148 330 297 257 sel 0;
+-1 -1 13000 1;
+#N canvas 148 330 301 261 sel 0;
#X obj 30 25 r \$0-r1;
#X obj 110 25 r \$0-r2;
#X obj 30 100 min;
@@ -336,6 +347,8 @@
#X text 10 35 (needs zexy!);
#X obj 18 410 vasp.u;
#X text 76 412 update graphics;
+#X obj 28 381 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
#X connect 0 0 37 0;
#X connect 0 1 18 0;
#X connect 1 0 0 1;
@@ -354,3 +367,4 @@
#X connect 24 0 27 0;
#X connect 28 0 0 0;
#X connect 35 0 0 3;
+#X connect 39 0 37 0;
diff --git a/externals/grill/vasp/pd/vasp.opt.pd b/externals/grill/vasp/pd/vasp.opt.pd
index 9e4b69a9..4f6dc597 100644
--- a/externals/grill/vasp/pd/vasp.opt.pd
+++ b/externals/grill/vasp/pd/vasp.opt.pd
@@ -1,9 +1,9 @@
-#N canvas 504 38 464 478 12;
+#N canvas 504 38 466 480 12;
#X obj 27 11 inlet;
#X obj 90 158 vasp.amax?;
#X obj 35 206 route 0 1;
#X obj 107 415 outlet;
-#X obj 165 415 outlet;
+#X obj 256 418 outlet;
#X obj 27 306 vasp;
#X obj 47 255 t b;
#X obj 90 116 vasp.m 2;
@@ -14,8 +14,8 @@
#X text 131 79 catch messages ("to" not handled);
#X obj 28 41 vasp.radio;
#X connect 0 0 13 0;
-#X connect 1 1 2 0;
-#X connect 1 1 4 0;
+#X connect 1 0 2 0;
+#X connect 1 0 4 0;
#X connect 2 0 6 0;
#X connect 2 1 6 0;
#X connect 2 2 9 0;
diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp
index 6e17b0a0..1a44a866 100644
--- a/externals/grill/xsample/source/main.cpp
+++ b/externals/grill/xsample/source/main.cpp
@@ -223,9 +223,12 @@ V xsample::m_dsp(I /*n*/,S *const * /*insigs*/,S *const * /*outsigs*/)
if(!m_refresh()) s_dsp();
}
-
+/*
V xsample::arrscale(I n,const S *src,S *dst,S add,S mul)
{
+#if 1
+ flext::ScaleSamples(dst,src,mul,add*mul,n);
+#else
int n8 = n>>3;
n -= n8<<3;
while(n8--) {
@@ -241,10 +244,14 @@ V xsample::arrscale(I n,const S *src,S *dst,S add,S mul)
}
while(n--) *(dst++) = (*(src++)+add)*mul;
+#endif
}
V xsample::arrmul(I n,const S *src,S *dst,S mul)
{
+#if 1
+ flext::MulSamples(dst,src,mul,n);
+#else
int n8 = n>>3;
n -= n8<<3;
while(n8--) {
@@ -260,8 +267,9 @@ V xsample::arrmul(I n,const S *src,S *dst,S mul)
}
while(n--) *(dst++) = *(src++)*mul;
+#endif
}
-
+*/
diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h
index bfbebfe2..2968624e 100644
--- a/externals/grill/xsample/source/main.h
+++ b/externals/grill/xsample/source/main.h
@@ -19,8 +19,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 402)
-#error You need at least flext version 0.4.2
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500)
+#error You need at least flext version 0.5.0
#endif
@@ -127,10 +127,10 @@ protected:
inline F scale(F smp) const { return (smp-sclmin)*sclmul; }
- static V arrscale(I n,const S *in,S *out,S add,S mul);
+ static V arrscale(I n,const S *in,S *out,S add,S mul) { flext::ScaleSamples(out,in,mul,add,n); }
inline V arrscale(I n,const S *in,S *out) const { arrscale(n,in,out,(S)-sclmin,sclmul); }
- static V arrmul(I n,const S *in,S *out,S mul);
+ static V arrmul(I n,const S *in,S *out,S mul) { flext::MulSamples(out,in,mul,n); }
inline V arrmul(I n,const S *in,S *out) const { arrmul(n,in,out,(S)(1./s2u)); }
BL bufchk();