aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flbase.cpp11
-rw-r--r--externals/grill/flext/source/flbase.h11
-rw-r--r--externals/grill/flext/source/flbuf.cpp8
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp11
4 files changed, 34 insertions, 7 deletions
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
index 032f869d..fd666632 100644
--- a/externals/grill/flext/source/flbase.cpp
+++ b/externals/grill/flext/source/flbase.cpp
@@ -44,6 +44,9 @@ int flext_obj::m_holdaargc = 0;
const t_atom *flext_obj::m_holdaargv = NULL;
bool flext_obj::process_attributes = false;
+bool flext_obj::initing = false;
+bool flext_obj::exiting = false;
+
void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
/////////////////////////////////////////////////////////
@@ -51,10 +54,10 @@ void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
//
/////////////////////////////////////////////////////////
flext_obj :: FLEXT_CLASSDEF(flext_obj)()
- : x_obj(m_holder)
- , procattr(m_holdattr)
- , init_ok(true)
- , m_name(m_holdname)
+ : x_obj(m_holder)
+ , procattr(m_holdattr)
+ , init_ok(true)
+ , m_name(m_holdname)
{
#if FLEXT_SYS == FLEXT_SYS_PD
m_canvas = canvas_getcurrent();
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index a9a9d8e5..47db0618 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -219,6 +219,9 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
//! Flag for successful object construction
bool init_ok;
+ // flags for init and exit procedure;
+ static bool initing,exiting;
+
public:
//! Creation callback
@@ -242,6 +245,14 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
//! Check whether construction was successful
bool InitOk() const { return init_ok; }
+ /*! Return true if in object initialization phase
+ true when in constructor or Init, false when in Finalize
+ */
+ static bool Initing() { return initing; }
+
+ //! Return true if in object destruction phase (Exit or destructor)
+ static bool Exiting() { return exiting; }
+
// Definitions for library objects
static void lib_init(const char *name,void setupfun(),bool attr);
static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),FLEXT_CLASSDEF(flext_obj) *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...);
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp
index 4dc0b6e8..649e1b8d 100644
--- a/externals/grill/flext/source/flbuf.cpp
+++ b/externals/grill/flext/source/flbuf.cpp
@@ -81,7 +81,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
if(!arr)
{
if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
- sym = NULL;
+// sym = NULL;
if(valid) ret = -1;
}
else if(!garray_getfloatarray(arr, &frames1, &data1))
@@ -147,11 +147,13 @@ bool flext::buffer::Valid() const
bool flext::buffer::Update()
{
- if(!Ok()) return false;
+// if(!Ok()) return false;
bool ok = false;
#if FLEXT_SYS == FLEXT_SYS_PD
+ if(!sym || !arr) return data == NULL;
+
int frames1;
t_sample *data1;
if(!garray_getfloatarray(arr, &frames1, &data1)) {
@@ -166,6 +168,8 @@ bool flext::buffer::Update()
ok = true;
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
+ if(!sym) return data == NULL;
+
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) {
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index 509ba2c2..2132ddf2 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -413,6 +413,7 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
flext_obj::m_holder = obj;
flext_obj::m_holdname = s;
flext_obj::m_holdattr = lo->attr;
+ flext_obj::initing = true;
// get actual flext object (newfun calls "new flext_obj()")
if(lo->argc >= 0)
@@ -446,6 +447,8 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
// here, inlets, outlets, methods and attributes can be set up
ok = obj->data->Init();
+ flext_obj::initing = false;
+
// call another virtual init function
if(ok) ok = obj->data->Finalize();
@@ -467,6 +470,8 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
ok = false;
}
+ flext_obj::initing = false;
+
if(!ok) {
// there was some init error, free object
lo->freefun(obj);
@@ -500,6 +505,8 @@ void flext_obj::obj_free(flext_hdr *h)
if(lcl) {
try {
+ flext_obj::exiting = true;
+
// call virtual exit function
hdr->data->Exit();
@@ -515,7 +522,9 @@ void flext_obj::obj_free(flext_hdr *h)
catch(...) {
error("%s - Unknown exception while destroying object",GetString(name));
}
- }
+
+ flext_obj::exiting = false;
+ }
#ifdef FLEXT_DEBUG
else
#if FLEXT_SYS == FLEXT_SYS_MAX