diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2009-04-01 21:13:09 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2009-04-01 21:13:09 +0000 |
commit | 0ed7a8b68dd73e2b0473b8127aeca99f3bac9061 (patch) | |
tree | 5c67818b38a5cc2f9caa5ca7f8640ca356adf02b /externals/grill/flext/source/fldsp.cpp | |
parent | bb4c7f6a245394d09dac9adfb2efb093d3d98452 (diff) |
cleaned up grill externals - replaced with svn:externals to svn.grrrr.org/ext/trunk/
svn path=/trunk/; revision=10951
Diffstat (limited to 'externals/grill/flext/source/fldsp.cpp')
-rw-r--r-- | externals/grill/flext/source/fldsp.cpp | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp deleted file mode 100644 index e741c22a..00000000 --- a/externals/grill/flext/source/fldsp.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - -flext - C++ layer for Max/MSP and pd (pure data) externals - -Copyright (c) 2001-2006 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. - -*/ - -/*! \file fldsp.cpp - \brief Implementation of the flext dsp base class. -*/ - -#include "flext.h" -#include "flinternal.h" -#include <string.h> - -// === flext_dsp ============================================== - -void flext_dsp::Setup(t_classid id) -{ -#if FLEXT_SYS == FLEXT_SYS_PD -// add_method1(c,cb_enable,"enable",A_FLOAT); - AddMethod(id,0,MakeSymbol("enable"),&cb_enable); -#endif -} - -flext_dsp::FLEXT_CLASSDEF(flext_dsp)() - : srate(sys_getsr()),blksz(sys_getblksize()) - , vecs(NULL) -#if FLEXT_SYS != FLEXT_SYS_MAX - , dspon(true) -#endif -{} - -void flext_dsp::Exit() -{ - flext_base::Exit(); - - if(vecs) delete[] vecs; -} - - -t_int *flext_dsp::dspmeth(t_int *w) -{ - flext_dsp *obj = (flext_dsp *)(size_t)w[1]; - -#if FLEXT_SYS == FLEXT_SYS_MAX - if(!obj->thisHdr()->z_disabled) -#else - if(LIKELY(obj->dspon)) -#endif - { - flext_base::indsp = true; - obj->CbSignal(); - flext_base::indsp = false; - } - return w+2; -} - -void flext_dsp::SetupDsp(t_signal **sp) -{ - int i; - 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 - 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) && !vecs) - vecs = new t_signalvec[in+out]; - - for(i = 0; i < in; ++i) - vecs[i] = sp[i]->s_vec; - for(i = 0; i < out; ++i) - vecs[in+i] = sp[in+i]->s_vec; - - // with the following call derived classes can do their eventual DSP setup - if(CbDsp()) { - // set the DSP function - 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() -{ - // invoke legacy method - m_dsp(Blocksize(),InSig(),OutSig()); - return true; -} - -// this function will be overridden anyway - the probably useless default is clearing all outputs -void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) -{ - for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n); -} - -void flext_dsp::CbSignal() -{ - // invoke legacy method - m_signal(Blocksize(),InSig(),OutSig()); -} - - -#if FLEXT_SYS == FLEXT_SYS_PD -//void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; } -bool flext_dsp::cb_enable(flext_base *b,float &on) { static_cast<flext_dsp *>(b)->dspon = on != 0; return true; } -#endif |