aboutsummaryrefslogtreecommitdiff
path: root/externals/grill
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill')
-rw-r--r--externals/grill/flext/flext.vcproj2
-rw-r--r--externals/grill/flext/source/flbuf.cpp66
-rwxr-xr-xexternals/grill/flext/source/flprefix.h5
-rwxr-xr-xexternals/grill/flext/source/flqueue.cpp4
-rw-r--r--externals/grill/flext/source/flsupport.h15
5 files changed, 78 insertions, 14 deletions
diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj
index d5cba32f..8a1792e3 100644
--- a/externals/grill/flext/flext.vcproj
+++ b/externals/grill/flext/flext.vcproj
@@ -412,7 +412,7 @@
InlineFunctionExpansion="2"
OmitFramePointers="FALSE"
AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\packs\pthreads,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_SHARED;FLEXT_EXPORTS;FLEXT_PDLOCK"
StringPooling="TRUE"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp
index c9d37983..2a1878d3 100644
--- a/externals/grill/flext/source/flbuf.cpp
+++ b/externals/grill/flext/source/flbuf.cpp
@@ -24,7 +24,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define DIRTY_INTERVAL 0 // buffer dirty check in msec
#endif
-
+// check if PD API supports buffer dirty time
+#if defined(PD_VERSION_DEVEL) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
+#if PD_MINOR_VERSION >= 36
+ #define FLEXT_PDBUFDIRTYTIME
+#endif
+#endif
flext::buffer::buffer(const t_symbol *bn,bool delayed):
sym(NULL),data(NULL),
@@ -39,6 +44,8 @@ flext::buffer::buffer(const t_symbol *bn,bool delayed):
#endif
if(bn) Set(bn,delayed);
+
+ ClearDirty();
}
flext::buffer::~buffer()
@@ -142,6 +149,8 @@ bool flext::buffer::Update()
{
if(!Ok()) return false;
+ bool ok = false;
+
#if FLEXT_SYS == FLEXT_SYS_PD
int frames1;
t_sample *data1;
@@ -149,32 +158,27 @@ bool flext::buffer::Update()
frames = 0;
data = NULL;
chns = 0;
- return true;
+ ok = true;
}
else if(data != data1 || frames != frames1) {
frames = frames1;
data = data1;
- return true;
+ ok = true;
}
- else
- return false;
#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(!sym->s_thing)
- return false;
- else {
+ if(sym->s_thing) {
const _buffer *p = (const _buffer *)sym->s_thing;
if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
data = p->b_samples;
chns = p->b_nchans;
frames = p->b_frames;
- return true;
+ ok = true;
}
- else
- return false;
}
#else
#error not implemented
#endif
+ return ok;
}
void flext::buffer::Frames(int fr,bool keep,bool zero)
@@ -265,7 +269,7 @@ void flext::buffer::Dirty(bool force)
FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
}
#else
-#error
+#error Not implemented
#endif
}
}
@@ -288,5 +292,43 @@ void flext::buffer::cb_tick(buffer *b)
}
#endif
+void flext::buffer::ClearDirty()
+{
+#if FLEXT_SYS == FLEXT_SYS_PD
+ cleantime = clock_getlogicaltime();
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ cleantime = gettime();
+#else
+#error Not implemented
+#endif
+}
+
+bool flext::buffer::IsDirty() const
+{
+#if FLEXT_SYS == FLEXT_SYS_PD
+ if(!arr) return false;
+ #ifdef FLEXT_PDBUFDIRTYTIME
+ return isdirty || garray_updatetime(arr) > cleantime;
+ #else
+ // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
+ return true;
+ #endif
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ if(!sym->s_thing) return false;
+
+ _buffer *p = (_buffer *)sym->s_thing;
+#ifdef FLEXT_DEBUG
+ if(NOGOOD(p)) {
+ post("buffer: buffer object '%s' no good",sym->s_name);
+ return false;
+ }
+#endif
+ return p->b_modtime > cleantime;
+#else
+#error Not implemented
+#endif
+}
#endif // Jmax
+
+
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
index 390f51ab..14a9edf6 100755
--- a/externals/grill/flext/source/flprefix.h
+++ b/externals/grill/flext/source/flprefix.h
@@ -302,6 +302,11 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef FLEXT_SHARED
#undef FLEXT_THREADS
#define FLEXT_THREADS
+/*
+ // and also enabled for virtual daughter-classes??
+ #undef FLEXT_VIRT
+ #define FLEXT_VIRT
+*/
#endif
#ifdef FLEXT_THREADS
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
index 34bf9b9f..8e6431c8 100755
--- a/externals/grill/flext/source/flqueue.cpp
+++ b/externals/grill/flext/source/flqueue.cpp
@@ -248,6 +248,10 @@ void QWorker(flext::thr_params *)
void flext_base::StartQueue()
{
+ static bool started = false;
+ if(started) return;
+ else started = true;
+
// message queue ticker
qhead = qtail = NULL;
qcnt = 0;
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 72bfcf3e..0ea42442 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -132,7 +132,15 @@ public:
\param refr: if true forces immediate graphics refresh
*/
void Dirty(bool refr = false);
-
+
+ //! Clear the dirty flag.
+ void ClearDirty();
+
+ /*! Query whether the buffer content has been changed since the last ClearDirty()
+ \note With mainstream versions of PD this will always return true, since the dirtiness can't be judged
+ */
+ bool IsDirty() const;
+
//! Get symbol of buffer
t_symbol *Symbol() const { return const_cast<t_symbol *>(sym); }
@@ -174,10 +182,15 @@ public:
bool ticking;
//! update clock
t_clock *tick;
+ //! last time the dirty flag was cleared (using the clock_getlogicaltime function)
+ double cleantime;
private:
//! update clock callback
static void cb_tick(buffer *b);
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ //! last time the dirty flag was cleared (using the gettime function)
+ long cleantime;
#endif
};