From dcbc90c265de6782a1dc6f2e5e7e9fa3c4743f87 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 26 Jan 2005 05:02:06 +0000 Subject: - fixed typos and 64-bit compatibility usage of symbols for method and attribute adding fixed buggy unbinding of receive symbols reconsidered flext::buffer:Update some restructuring added object construction and destruction flags better templates, some minor changes build system: added profiler mode, more fixes added method for clicks into object box - conform to idle callback functionality in devel_0_38 oops, forgot about SIMD for Windows fix for ToOut calls in dsp time svn path=/trunk/; revision=2540 --- externals/grill/flext/source/fldsp.cpp | 63 ++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'externals/grill/flext/source/fldsp.cpp') diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 3dd97f4c..91400346 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -28,7 +28,6 @@ void flext_dsp::Setup(t_classid id) #if FLEXT_SYS == FLEXT_SYS_MAX dsp_initclass(); -// dsp_initboxclass(); 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 @@ -100,11 +99,15 @@ t_int *flext_dsp::dspmeth(t_int *w) #endif */ #if FLEXT_SYS == FLEXT_SYS_MAX - if(!obj->thisHdr()->z_disabled) + if(!obj->thisHdr()->z_disabled) #else - if(obj->dspon) + if(obj->dspon) #endif + { + obj->indsp = true; obj->m_signal(obj->blksz,obj->invecs,obj->outvecs); + obj->indsp = false; + } return w+2; } #endif @@ -119,7 +122,15 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp) { flext_dsp *obj = thisObject(c); - if(obj->CntInSig()+obj->CntOutSig() == 0) return; + int i; + int in = obj->CntInSig(); + int out = obj->CntOutSig(); +#if FLEXT_SYS == FLEXT_SYS_PD + // min. 1 input channel! (CLASS_MAININLET in pd...) + if(!in) in = 1; +#else + if(in+out == 0) return; +#endif // store current dsp parameters #if FLEXT_SYS == FLEXT_SYS_JMAX @@ -132,33 +143,31 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp) #endif // store in and out signal vectors - int i; - int in = obj->chnsin = obj->CntInSig(); - int out = obj->chnsout = obj->CntOutSig(); - -#if FLEXT_SYS == FLEXT_SYS_PD - // min. 1 input channel! (CLASS_MAININLET in pd...) - if(!in) { obj->chnsin = in = 1; } -#endif - if(obj->invecs) delete[] obj->invecs; - obj->invecs = new t_signalvec[in]; + if(in != obj->chnsin) { + if(obj->invecs) delete[] obj->invecs; + obj->invecs = in?new t_signalvec[in]:NULL; + obj->chnsin = in; + } for(i = 0; i < in; ++i) obj->invecs[i] = #if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_get_input_name(dsp,i); + fts_dsp_get_input_name(dsp,i); #else - sp[i]->s_vec; + sp[i]->s_vec; #endif - if(obj->outvecs) delete[] obj->outvecs; - obj->outvecs = new t_signalvec[out]; + if(out != obj->chnsout) { + if(obj->outvecs) delete[] obj->outvecs; + obj->outvecs = out?new t_signalvec[out]:NULL; + obj->chnsout = out; + } for(i = 0; i < out; ++i) obj->outvecs[i] = #if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_get_output_name(dsp,i); + fts_dsp_get_output_name(dsp,i); #else - sp[in+i]->s_vec; + sp[in+i]->s_vec; #endif // with the following call derived classes can do their eventual DSP setup @@ -195,15 +204,9 @@ void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *out for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n); } -#if FLEXT_SYS != FLEXT_SYS_MAX - #if FLEXT_SYS == FLEXT_SYS_PD -void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->m_enable(on != 0); } +void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->dspon = on != 0; } #elif FLEXT_SYS == FLEXT_SYS_JMAX -void flext_dsp::cb_enable(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) -{ thisObject(c)->m_enable(fts_get_int(at+0) != 0); } -#endif - -void flext_dsp::m_enable(bool en) { dspon = en; } +void flext_dsp::cb_enable(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +{ thisObject(c)->dspon = fts_get_int(at+0) != 0; } #endif - -- cgit v1.2.1