aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/fldsp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source/fldsp.cpp')
-rw-r--r--externals/grill/flext/source/fldsp.cpp61
1 files changed, 17 insertions, 44 deletions
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp
index f6f109ad..753779cc 100644
--- a/externals/grill/flext/source/fldsp.cpp
+++ b/externals/grill/flext/source/fldsp.cpp
@@ -23,14 +23,12 @@ void flext_dsp::Setup(t_classid id)
t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_MAX
- dsp_initclass();
- add_dsp(c,cb_dsp);
-#elif FLEXT_SYS == FLEXT_SYS_PD
- CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
- add_dsp(c,cb_dsp);
+ if(!IsLib(id))
+#endif
+ AddSignalMethods(c);
+
+#if FLEXT_SYS == FLEXT_SYS_PD
add_method1(c,cb_enable,"enable",A_FLOAT);
-#else
-#error Platform not supported!
#endif
}
@@ -42,26 +40,8 @@ flext_dsp::FLEXT_CLASSDEF(flext_dsp)()
#endif
{}
-#if FLEXT_SYS == FLEXT_SYS_MAX
-bool flext_dsp::Init()
-{
- if(!flext_base::Init())
- return false;
-
- // according to the Max/MSP SDK this should be prior to any inlet creation, BUT
- // that doesn't seem to be true... multiple signal ins and additional inlets don't seem to work then
- dsp_setup(thisHdr(),CntInSig()); // signal inlets
- return true;
-}
-#endif
-
void flext_dsp::Exit()
{
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // according to David Z. one should do that first...
- dsp_free(thisHdr());
-#endif
-
flext_base::Exit();
if(vecs) delete[] vecs;
@@ -85,44 +65,37 @@ t_int *flext_dsp::dspmeth(t_int *w)
return w+2;
}
-#if FLEXT_SYS == FLEXT_SYS_MAX
-void flext_dsp::cb_dsp(t_class *c,t_signal **sp,short *count)
-#else
-void flext_dsp::cb_dsp(t_class *c,t_signal **sp)
-#endif
+void flext_dsp::SetupDsp(t_signal **sp)
{
- flext_dsp *obj = thisObject(c);
-
int i;
- int in = obj->CntInSig();
- int out = obj->CntOutSig();
+ int in = CntInSig();
+ int out = CntOutSig();
#if FLEXT_SYS == FLEXT_SYS_PD
// min. 1 input channel! (CLASS_MAININLET in pd...)
if(!in) in = 1;
#endif
// store current dsp parameters
- obj->srate = sp[0]->s_sr;
- obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
+ srate = sp[0]->s_sr;
+ blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
// store in and out signal vectors
- if((in+out) && !obj->vecs)
- obj->vecs = new t_signalvec[in+out];
+ if((in+out) && !vecs)
+ vecs = new t_signalvec[in+out];
for(i = 0; i < in; ++i)
- obj->vecs[i] = sp[i]->s_vec;
+ vecs[i] = sp[i]->s_vec;
for(i = 0; i < out; ++i)
- obj->vecs[in+i] = sp[in+i]->s_vec;
+ vecs[in+i] = sp[in+i]->s_vec;
// with the following call derived classes can do their eventual DSP setup
- if(obj->CbDsp()) {
+ if(CbDsp()) {
// set the DSP function
- dsp_add((t_dspmethod)dspmeth,1,obj);
+ dsp_add((t_dspmethod)dspmeth,1,this);
}
}
-
void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {}
bool flext_dsp::CbDsp()
@@ -146,5 +119,5 @@ void flext_dsp::CbSignal()
#if FLEXT_SYS == FLEXT_SYS_PD
-void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->dspon = on != 0; }
+void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; }
#endif