Commit d1c5f00e authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@286 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 77f1797c
......@@ -2,7 +2,8 @@
flext_sndobj::flext_sndobj():
inobjs(0),outobjs(0),
inobj(NULL),tmpobj(NULL),outobj(NULL)
inobj(NULL),tmpobj(NULL),outobj(NULL),
smprt(0),blsz(0)
{}
flext_sndobj::~flext_sndobj()
......@@ -30,20 +31,33 @@ void flext_sndobj::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();
blsz = Blocksize();
smprt = Samplerate();
// set up sndobjs for inlets and outlets
int i;
inobj = new Inlet *[inobjs = CntInSig()];
tmpobj = new SndObj *[inobjs];
for(i = 0; i < inobjs; ++i) {
inobj[i] = new Inlet(in[i],Blocksize(),Samplerate());
tmpobj[i] = new SndObj(NULL,Blocksize(),Samplerate());
inobj[i] = new Inlet(in[i],blsz,smprt);
tmpobj[i] = new SndObj(NULL,blsz,smprt);
}
outobj = new Outlet *[outobjs = CntInSig()];
for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],Blocksize(),Samplerate());
for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt);
NewObjs();
}
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_sndobj::m_signal(int n,t_sample *const *in,t_sample *const *out)
......
......@@ -47,6 +47,8 @@ private:
virtual short Read();
virtual short Write();
void SetBuf(const t_sample *b) { buf = b; }
private:
const t_sample *buf;
};
......@@ -60,6 +62,8 @@ private:
virtual short Read();
virtual short Write();
void SetBuf(t_sample *b) { buf = b; }
private:
t_sample *buf;
};
......@@ -70,6 +74,9 @@ private:
SndObj **tmpobj;
Inlet **inobj;
Outlet **outobj;
float smprt;
int blsz;
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment