cwFlowType.h/cpp : Convert fbuf_t binN and hopSmpN_V to vectors.
This commit is contained in:
parent
c1a0e7708b
commit
df3a948608
@ -175,7 +175,11 @@ namespace cw
|
|||||||
if( v->u.fbuf == nullptr )
|
if( v->u.fbuf == nullptr )
|
||||||
printf("fbuf: <null>");
|
printf("fbuf: <null>");
|
||||||
else
|
else
|
||||||
printf("fbuf: chN:%i binN:%i hopSmpN:%i srate:%8.1f", v->u.fbuf->chN, v->u.fbuf->binN, v->u.fbuf->hopSmpN, v->u.fbuf->srate );
|
{
|
||||||
|
printf("fbuf: chN:%i srate:%8.1f ", v->u.fbuf->chN, v->u.fbuf->srate );
|
||||||
|
for(unsigned i; i<v->u.fbuf->chN; ++i)
|
||||||
|
printf("(binN:%i hopSmpN:%i) ", v->u.fbuf->binN_V[i], v->u.fbuf->hopSmpN_V[i] );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBoolMtxTFl:
|
case kBoolMtxTFl:
|
||||||
@ -907,13 +911,19 @@ cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, unsigned
|
|||||||
|
|
||||||
f->srate = srate;
|
f->srate = srate;
|
||||||
f->chN = chN;
|
f->chN = chN;
|
||||||
f->binN = binN;
|
f->binN_V = mem::allocZ<unsigned>(chN);;
|
||||||
f->hopSmpN = hopSmpN;
|
f->hopSmpN_V = mem::allocZ<unsigned>(chN);
|
||||||
f->magV = mem::allocZ<sample_t*>(chN);
|
f->magV = mem::allocZ<sample_t*>(chN);
|
||||||
f->phsV = mem::allocZ<sample_t*>(chN);
|
f->phsV = mem::allocZ<sample_t*>(chN);
|
||||||
f->hzV = mem::allocZ<sample_t*>(chN);
|
f->hzV = mem::allocZ<sample_t*>(chN);
|
||||||
f->readyFlV= mem::allocZ<bool>(chN);
|
f->readyFlV= mem::allocZ<bool>(chN);
|
||||||
|
|
||||||
|
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
||||||
|
{
|
||||||
|
f->binN_V[chIdx] = binN;
|
||||||
|
f->hohpSmpN_V[chIdx] = hopSmpN;
|
||||||
|
}
|
||||||
|
|
||||||
if( magV != nullptr || phsV != nullptr || hzV != nullptr )
|
if( magV != nullptr || phsV != nullptr || hzV != nullptr )
|
||||||
{
|
{
|
||||||
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
||||||
@ -946,6 +956,8 @@ void cw::flow::fbuf_destroy( fbuf_t*& fbuf )
|
|||||||
if( fbuf == nullptr )
|
if( fbuf == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mem::release( fbuf->binN_V );
|
||||||
|
mem::release( fbuf->hopSmpN_V);
|
||||||
mem::release( fbuf->magV);
|
mem::release( fbuf->magV);
|
||||||
mem::release( fbuf->phsV);
|
mem::release( fbuf->phsV);
|
||||||
mem::release( fbuf->hzV);
|
mem::release( fbuf->hzV);
|
||||||
@ -959,9 +971,12 @@ cw::flow::fbuf_t* cw::flow::fbuf_duplicate( const fbuf_t* src )
|
|||||||
fbuf_t* fbuf = fbuf_create( src->srate, src->chN, src->binN, src->hopSmpN );
|
fbuf_t* fbuf = fbuf_create( src->srate, src->chN, src->binN, src->hopSmpN );
|
||||||
for(unsigned i=0; i<fbuf->chN; ++i)
|
for(unsigned i=0; i<fbuf->chN; ++i)
|
||||||
{
|
{
|
||||||
vop::copy( fbuf->magV[i], src->magV[i], fbuf->binN );
|
fbuf->binN_V[i] = src->binN_V[i];
|
||||||
vop::copy( fbuf->phsV[i], src->phsV[i], fbuf->binN );
|
fbuf->hopSmpN_V[i] = src->hopSmpN_V[i];
|
||||||
vop::copy( fbuf->hzV[i], src->hzV[i], fbuf->binN );
|
|
||||||
|
vop::copy( fbuf->magV[i], src->magV[i], fbuf->binN_V[i] );
|
||||||
|
vop::copy( fbuf->phsV[i], src->phsV[i], fbuf->binN_V[i] );
|
||||||
|
vop::copy( fbuf->hzV[i], src->hzV[i], fbuf->binN_V[i] );
|
||||||
}
|
}
|
||||||
return fbuf;
|
return fbuf;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ namespace cw
|
|||||||
srate_t srate; // signal sample rate
|
srate_t srate; // signal sample rate
|
||||||
unsigned flags; // See kXXXFbufFl
|
unsigned flags; // See kXXXFbufFl
|
||||||
unsigned chN; // count of channels
|
unsigned chN; // count of channels
|
||||||
unsigned binN; // count of sample frames per channel
|
unsigned* binN_V; // binN_V[ chN ] count of sample frames per channel
|
||||||
unsigned hopSmpN; // hop sample count
|
unsigned* hopSmpN_V; // hopSmpN_V[ chN ] hop sample count
|
||||||
sample_t** magV; // magV[ chN ][ binN ]
|
sample_t** magV; // magV[ chN ][ binN ]
|
||||||
sample_t** phsV; // phsV[ chN ][ binN ]
|
sample_t** phsV; // phsV[ chN ][ binN ]
|
||||||
sample_t** hzV; // hzV[ chN ][ binN ]
|
sample_t** hzV; // hzV[ chN ][ binN ]
|
||||||
|
Loading…
Reference in New Issue
Block a user