aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/grill/flext/changes.txt1
-rw-r--r--externals/grill/flext/flext.cwbin789029 -> 789029 bytes
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp6
-rwxr-xr-xexternals/grill/flext/source/flprefix.h8
-rw-r--r--externals/grill/flext/source/flsupport.cpp6
-rw-r--r--externals/grill/flext/source/flsupport.h81
-rw-r--r--externals/grill/flext/source/flthr.cpp58
-rw-r--r--externals/grill/vasp/config-pd-linux.txt3
-rw-r--r--externals/grill/vasp/makefile.pd-linux14
-rw-r--r--externals/grill/vasp/vasp.cwbin356360 -> 356360 bytes
-rw-r--r--externals/grill/xsample/source/groove.cpp4
-rwxr-xr-xexternals/grill/xsample/source/inter.h2
-rwxr-xr-xexternals/grill/xsample/xsample.cwbin280733 -> 279503 bytes
13 files changed, 110 insertions, 73 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index f4539886..982e0002 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -24,6 +24,7 @@ Version history:
- flext::StopThread function to terminate running threads (started with LaunchThread)
- added flext::post() and flext::error() console printing (thread-safe)
- added flext::CmpAtom and AtomList::operator < methods ... useful for using lists as keys for STL
+- make use of new PD thread locking (PD functions sys_lock() and sys_unlock())
0.4.4:
- fixed deadly bug for Max/MSP method-to-symbol-binding proxies
diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw
index 333da537..f952b7f9 100644
--- a/externals/grill/flext/flext.cw
+++ b/externals/grill/flext/flext.cw
Binary files differ
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
index 898c4dd6..e4989320 100644
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ b/externals/grill/flext/source/flatom_pr.cpp
@@ -18,12 +18,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <string.h>
#include <stdio.h>
-#ifdef __MWERKS__
-#define STD std
-#else
-#define STD
-#endif
-
void flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
GetAString(a,buf,bufsz?bufsz:100000);
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
index 14a9edf6..2399eef5 100755
--- a/externals/grill/flext/source/flprefix.h
+++ b/externals/grill/flext/source/flprefix.h
@@ -334,4 +334,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#endif
#endif
+// std namespace
+#ifdef __MWERKS__
+#define STD std
+#else
+#define STD
+#endif
+
+
#endif // __FLEXT_PREFIX_H
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 9e6a2491..78aeb6d0 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -141,9 +141,9 @@ void flext::GetAString(const t_atom &a,char *buf,int szbuf)
atom_string(const_cast<t_atom *>(&a),buf,szbuf);
#else
// no checking for size here
- if(IsSymbol(a)) sprintf(buf,GetString(a));
- else if(IsFloat(a)) sprintf(buf,"%f",GetFloat(a));
- else if(IsInt(a)) sprintf(buf,"%i",GetInt(a));
+ if(IsSymbol(a)) STD::sprintf(buf,GetString(a));
+ else if(IsFloat(a)) STD::sprintf(buf,"%f",GetFloat(a));
+ else if(IsInt(a)) STD::sprintf(buf,"%i",GetInt(a));
else *buf = 0;
#endif
}
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index f2129d7c..b2132289 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -16,11 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLSUPPORT_H
#include "flstdc.h"
-#include <time.h>
-#if FLEXT_OS == FLEXT_OS_WIN
-#include <sys/timeb.h>
-#endif
class FLEXT_SHARE flext_base;
@@ -296,12 +292,7 @@ public:
//! Compare two atoms
static int CmpAtom(const t_atom &a,const t_atom &b);
- static bool operator ==(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) == 0; }
- static bool operator !=(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) != 0; }
- static bool operator <(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) < 0; }
- static bool operator <=(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) <= 0; }
- static bool operator >(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) > 0; }
- static bool operator >=(const t_atom &a,const t_atom &b) { return CmpAtom(a,b) >= 0; }
+ // there are some more comparison functions for t_atom types outside the class
#if FLEXT_SYS == FLEXT_SYS_JMAX
//! Set atom from another atom
@@ -755,10 +746,10 @@ public:
//! Lock thread mutex
bool Lock() { return pthread_mutex_lock(&mutex) == 0; }
- /*! \brief Wait to lock thread mutex.
+ /*! Wait to lock thread mutex.
\todo Implement!
*/
- bool WaitForLock(double tm) { return pthread_mutex_lock(&mutex) == 0; }
+// bool WaitForLock(double tm) { return pthread_mutex_lock(&mutex) == 0; }
//! Try to lock, but don't wait
bool TryLock() { return pthread_mutex_trylock(&mutex) == 0; }
//! Unlock thread mutex
@@ -779,7 +770,7 @@ public:
//! Lock thread mutex
bool Lock() { return MPEnterCriticalRegion(crit,kDurationForever) == noErr; }
//! Wait to lock thread mutex
- bool WaitForLock(double tm) { return MPEnterCriticalRegion(crit,tm*kDurationMicrosecond*1.e6) == noErr; }
+// bool WaitForLock(double tm) { return MPEnterCriticalRegion(crit,tm*kDurationMicrosecond*1.e6) == noErr; }
//! Try to lock, but don't wait
bool TryLock() { return MPEnterCriticalRegion(crit,kDurationImmediate) == noErr; }
//! Unlock thread mutex
@@ -806,57 +797,19 @@ public:
~ThrCond() { pthread_cond_destroy(&cond); }
//! Wait for condition
- bool Wait() {
- Lock();
- bool ret = pthread_cond_wait(&cond,&mutex) == 0;
- Unlock();
- return ret;
- }
+ bool Wait();
- /*! \brief Wait for condition (for a certain time).
+ /*! Wait for condition (for a certain time).
\param ftime Wait time in seconds
\ret 0 = signalled, 1 = timed out
\remark If ftime = 0 this may suck away your cpu if used in a signalled loop.
+ \remark The time resolution of the implementation is required to be at least ms.
*/
- bool TimedWait(double ftime)
- {
- timespec tm;
-#if FLEXT_OS == FLEXT_OS_WIN
- _timeb tmb;
- _ftime(&tmb);
- tm.tv_nsec = tmb.millitm*1000000;
- tm.tv_sec = tmb.time;
-#else
- #if 0 // find out when the following is defined
- clock_gettime(CLOCK_REALTIME,tm);
- #else
- struct timeval tp;
- rs = gettimeofday(&tp, NULL);
- tm.tv_nsec = tp.tv_usec*1000;
- tm.tv_sec = tp.tv_sec;
- #endif
-#endif
- tm.tv_nsec += (long)((ftime-(long)ftime)*1.e9);
- long nns = tm.tv_nsec%1000000000;
- tm.tv_sec += (long)ftime+(tm.tv_nsec-nns)/1000000000;
- tm.tv_nsec = nns;
-
- Lock();
- bool ret = pthread_cond_timedwait(&cond,&mutex,&tm) == 0;
- Unlock();
- return ret;
- }
+ bool TimedWait(double ftime);
//! Signal condition
- bool Signal()
- {
- Lock();
- bool ret = pthread_cond_signal(&cond) == 0;
- Unlock();
- return ret;
- }
- //! Broadcast condition
-// int Broadcast() { return pthread_cond_broadcast(&cond); }
+ bool Signal();
+
protected:
pthread_cond_t cond;
};
@@ -878,8 +831,7 @@ public:
//! Signal condition
bool Signal() { return MPSetEvent(ev,1) == noErr; } // one bit needs to be set at least
- //! Broadcast condition
-// int Broadcast() { return pthread_cond_broadcast(&cond); }
+
protected:
MPEventID ev;
};
@@ -1050,4 +1002,15 @@ protected:
static unsigned long simdcaps;
};
+
+// gcc doesn't like these to be included into the flext class (even if static)
+inline bool operator ==(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) == 0; }
+inline bool operator !=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) != 0; }
+inline bool operator <(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) < 0; }
+inline bool operator <=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) <= 0; }
+inline bool operator >(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) > 0; }
+inline bool operator >=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) >= 0; }
+
+
+
#endif
diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp
index 84623a3d..0846805c 100644
--- a/externals/grill/flext/source/flthr.cpp
+++ b/externals/grill/flext/source/flthr.cpp
@@ -17,6 +17,16 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef FLEXT_THREADS
+
+#include <time.h>
+
+#if FLEXT_OS == FLEXT_OS_WIN
+#include <sys/timeb.h>
+#elif FLEXT_OS == FLEXT_OS_LINUX
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
#include <errno.h>
//! Thread id of system thread
@@ -492,4 +502,52 @@ flext_base::thr_entry::thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t i
{}
+
+#if FLEXT_THREADS == FLEXT_THR_POSIX
+bool flext::ThrCond::Wait() {
+ Lock();
+ bool ret = pthread_cond_wait(&cond,&mutex) == 0;
+ Unlock();
+ return ret;
+}
+
+bool flext::ThrCond::TimedWait(double ftime)
+{
+ timespec tm;
+#if FLEXT_OS == FLEXT_OS_WIN
+ _timeb tmb;
+ _ftime(&tmb);
+ tm.tv_nsec = tmb.millitm*1000000;
+ tm.tv_sec = tmb.time;
+#else
+#if 0 // find out when the following is defined
+ clock_gettime(CLOCK_REALTIME,tm);
+#else
+ struct timeval tp;
+ gettimeofday(&tp, NULL);
+ tm.tv_nsec = tp.tv_usec*1000;
+ tm.tv_sec = tp.tv_sec;
+#endif
+#endif
+ tm.tv_nsec += (long)((ftime-(long)ftime)*1.e9);
+ long nns = tm.tv_nsec%1000000000;
+ tm.tv_sec += (long)ftime+(tm.tv_nsec-nns)/1000000000;
+ tm.tv_nsec = nns;
+
+ Lock();
+ bool ret = pthread_cond_timedwait(&cond,&mutex,&tm) == 0;
+ Unlock();
+ return ret;
+}
+
+bool flext::ThrCond::Signal()
+{
+ Lock();
+ bool ret = pthread_cond_signal(&cond) == 0;
+ Unlock();
+ return ret;
+}
+#endif
+
+
#endif // FLEXT_THREADS
diff --git a/externals/grill/vasp/config-pd-linux.txt b/externals/grill/vasp/config-pd-linux.txt
index 9aca43b3..32fdb9fc 100644
--- a/externals/grill/vasp/config-pd-linux.txt
+++ b/externals/grill/vasp/config-pd-linux.txt
@@ -33,3 +33,6 @@ HELPDIR=${PD}/doc/5.reference
# (check if they fit to your system!)
# UFLAGS=-mcpu=pentium3 -msse -mfpmath=sse -fprefetch-loop-arrays
UFLAGS=-mcpu=pentiumpro
+
+# define to link against shared flext library (flext version >= 0.5.0)
+#FLEXT_SHARED=1
diff --git a/externals/grill/vasp/makefile.pd-linux b/externals/grill/vasp/makefile.pd-linux
index 4caa0097..04d971ef 100644
--- a/externals/grill/vasp/makefile.pd-linux
+++ b/externals/grill/vasp/makefile.pd-linux
@@ -24,6 +24,16 @@ LDFLAGS=-Wl,-s
LIBS=m
+
+ifdef FLEXT_SHARED
+CFLAGS+=-DFLEXT_SHARED
+LDFLAGS+=-Bdynamic
+LINKFLEXT=-lflext
+else
+LINKFLEXT=$(FLEXTLIB)
+endif
+
+
# ----------------------------------------------
# the rest can stay untouched
# ----------------------------------------------
@@ -48,8 +58,8 @@ $(TARGDIR):
$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
-$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
- $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -L$(FLEXTPATH) $(LINKFLEXT) -o $@
strip --strip-unneeded $@
chmod 755 $@
diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw
index f0229a51..5d268ff4 100644
--- a/externals/grill/vasp/vasp.cw
+++ b/externals/grill/vasp/vasp.cw
Binary files differ
diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp
index 7107f791..41f2248b 100644
--- a/externals/grill/xsample/source/groove.cpp
+++ b/externals/grill/xsample/source/groove.cpp
@@ -452,7 +452,7 @@ V xgroove::s_pos_loop(I n,S *const *invecs,S *const *outvecs)
S *pos = outvecs[outchns];
BL lpbang = false;
- const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ const D smin = curmin,smax = curmax,plen = smax-smin; //curlen;
if(buf && plen > 0) {
register D o = curpos;
@@ -461,7 +461,7 @@ V xgroove::s_pos_loop(I n,S *const *invecs,S *const *outvecs)
const S spd = speed[i]; // must be first because the vector is reused for output!
// normalize offset
- if(o >= smax) {
+ if(!(o < smax)) { // faster than o >= smax
o = fmod(o-smin,plen)+smin;
lpbang = true;
}
diff --git a/externals/grill/xsample/source/inter.h b/externals/grill/xsample/source/inter.h
index 697c66df..bd8ec894 100755
--- a/externals/grill/xsample/source/inter.h
+++ b/externals/grill/xsample/source/inter.h
@@ -156,7 +156,7 @@ TMPLDEF V xinter::st_play4(const S *bdt,const I smin,const I smax,const I n,cons
for(I ci = 0; ci < OCHNS; ++ci) {
const F cmb = fc[ci]-fb[ci];
sig[ci][si] = fb[ci] + frac*(
- cmb - 0.5f*(frac-1.) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb))
+ cmb - 0.5f*(frac-1.0f) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb))
);
}
}
diff --git a/externals/grill/xsample/xsample.cw b/externals/grill/xsample/xsample.cw
index 0c54ecad..8065e314 100755
--- a/externals/grill/xsample/xsample.cw
+++ b/externals/grill/xsample/xsample.cw
Binary files differ