diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2004-06-21 14:08:57 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2004-06-21 14:08:57 +0000 |
commit | e728a5bc3db296b4b67c2d3e5b56558c42c566a8 (patch) | |
tree | 180656eeb13352bc2cee7fb759e2ff74332069d2 /externals/grill/flext/source/flstk.cpp | |
parent | cefab503b7db648244a4244ef255d15609e2c205 (diff) |
""
svn path=/trunk/; revision=1826
Diffstat (limited to 'externals/grill/flext/source/flstk.cpp')
-rw-r--r-- | externals/grill/flext/source/flstk.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/externals/grill/flext/source/flstk.cpp b/externals/grill/flext/source/flstk.cpp index 42f2fa85..24739b28 100644 --- a/externals/grill/flext/source/flstk.cpp +++ b/externals/grill/flext/source/flstk.cpp @@ -12,105 +12,105 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstk.h" flext_stk::flext_stk(): - inobjs(0),outobjs(0), - inobj(NULL),outobj(NULL), - smprt(0),blsz(0) + inobjs(0),outobjs(0), + inobj(NULL),outobj(NULL), + smprt(0),blsz(0) {} bool flext_stk::Init() { - bool ret = flext_dsp::Init(); - inobjs = CntInSig(); - outobjs = CntOutSig(); - return ret; + bool ret = flext_dsp::Init(); + inobjs = CntInSig(); + outobjs = CntOutSig(); + return ret; } void flext_stk::Exit() { - ClearObjs(); - flext_dsp::Exit(); + ClearObjs(); + flext_dsp::Exit(); } void flext_stk::ClearObjs() { - FreeObjs(); - - if(inobj) { - for(int i = 0; i < inobjs; ++i) delete inobj[i]; - delete[] inobj; inobj = NULL; - } - if(outobj) { - for(int i = 0; i < outobjs; ++i) delete outobj[i]; - delete[] outobj; outobj = NULL; - } + FreeObjs(); + + if(inobj) { + for(int i = 0; i < inobjs; ++i) delete inobj[i]; + delete[] inobj; inobj = NULL; + } + if(outobj) { + for(int i = 0; i < outobjs; ++i) delete outobj[i]; + delete[] outobj; outobj = NULL; + } } void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out) { - // called on every rebuild of the dsp chain - - int i; - - if(Blocksize() != blsz || Samplerate() != smprt) { - // block size or sample rate has changed... rebuild all objects - - ClearObjs(); - - smprt = Samplerate(); - blsz = Blocksize(); - Stk::setSampleRate(smprt); - - // set up sndobjs for inlets and outlets - if(inobjs) { - inobj = new Input *[inobjs]; - for(i = 0; i < inobjs; ++i) - inobj[i] = new Input(in[i],blsz); - } - if(outobjs) { - outobj = new Output *[outobjs]; - for(i = 0; i < outobjs; ++i) - outobj[i] = new Output(out[i],blsz); - } - - if(!NewObjs()) ClearObjs(); - } - else { - // assign changed input/output vectors - - for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]); - for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]); - } + // called on every rebuild of the dsp chain + + int i; + + if(Blocksize() != blsz || Samplerate() != smprt) { + // block size or sample rate has changed... rebuild all objects + + ClearObjs(); + + smprt = Samplerate(); + blsz = Blocksize(); + Stk::setSampleRate(smprt); + + // set up sndobjs for inlets and outlets + if(inobjs) { + inobj = new Input *[inobjs]; + for(i = 0; i < inobjs; ++i) + inobj[i] = new Input(in[i],blsz); + } + if(outobjs) { + outobj = new Output *[outobjs]; + for(i = 0; i < outobjs; ++i) + outobj[i] = new Output(out[i],blsz); + } + + if(!NewObjs()) ClearObjs(); + } + else { + // assign changed input/output vectors + + for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]); + for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]); + } } void flext_stk::m_signal(int n,t_sample *const *in,t_sample *const *out) { - if(inobjs || outobjs) ProcessObjs(blsz); + if(inobjs || outobjs) ProcessObjs(blsz); } // inlet class flext_stk::Input::Input(const t_sample *b,int v): - buf(b),vecsz(v), - index(0) + buf(b),vecsz(v), + index(0) {} MY_FLOAT *flext_stk::Input::tick(MY_FLOAT *vector,unsigned int vectorSize) { - for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick(); - return vector; + for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick(); + return vector; } // outlet class flext_stk::Output::Output(t_sample *b,int v): - buf(b),vecsz(v), - index(0) + buf(b),vecsz(v), + index(0) {} void flext_stk::Output::tick(const MY_FLOAT *vector,unsigned int vectorSize) { - for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]); + for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]); } |