Introduced fd_real_t to allow fbuf_t internal data vectors to be type double.
This commit is contained in:
parent
c9e4745d3e
commit
b9e01aa288
@ -260,4 +260,21 @@ namespace cw
|
|||||||
return kOkRC;
|
return kOkRC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
namespace spec_dist
|
||||||
|
{
|
||||||
|
rc_t _test_one( const object_t* arg, )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
rc_t create( struct obj_str<T0,T1>*& p, unsigned binN, bool bypassFl=false, T1 ceiling=30, T1 expo=2, T1 thresh=60, T1 uprSlope=0, T1 lwrSlope=2, T1 mix=0 )
|
||||||
|
|
||||||
|
rc_t test( const object_t* args )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -538,17 +538,17 @@ namespace cw
|
|||||||
kCalcHzPvaFl = 0x01,
|
kCalcHzPvaFl = 0x01,
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
struct obj_str
|
struct obj_str
|
||||||
{
|
{
|
||||||
struct shift_buf::obj_str<T>* sb;
|
struct shift_buf::obj_str<T0>* sb;
|
||||||
struct fft::obj_str<T>* ft;
|
struct wnd_func::obj_str<T0>* wf;
|
||||||
struct wnd_func::obj_str<T>* wf;
|
struct fft::obj_str<T1>* ft;
|
||||||
struct phs_to_frq::obj_str<T>* pf;
|
struct phs_to_frq::obj_str<T1>* pf;
|
||||||
|
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
unsigned procSmpCnt;
|
unsigned procSmpCnt;
|
||||||
T srate;
|
T1 srate;
|
||||||
|
|
||||||
unsigned maxWndSmpCnt;
|
unsigned maxWndSmpCnt;
|
||||||
unsigned maxBinCnt;
|
unsigned maxBinCnt;
|
||||||
@ -557,21 +557,21 @@ namespace cw
|
|||||||
unsigned hopSmpCnt;
|
unsigned hopSmpCnt;
|
||||||
unsigned binCnt;
|
unsigned binCnt;
|
||||||
|
|
||||||
const T* magV; // amplitude NOT power - alias to ft->magV
|
const T1* magV; // amplitude NOT power - alias to ft->magV
|
||||||
const T* phsV; // alias to ft->phsV
|
const T1* phsV; // alias to ft->phsV
|
||||||
const T* hzV;
|
const T1* hzV;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef obj_str< float > fobj_t;
|
typedef obj_str< float, float > fobj_t;
|
||||||
typedef obj_str< double> dobj_t;
|
typedef obj_str< double, double> dobj_t;
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t create( struct obj_str<T>*& p, unsigned procSmpCnt, const T& srate, unsigned maxWndSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt, unsigned flags )
|
rc_t create( struct obj_str<T0,T1>*& p, unsigned procSmpCnt, const T1& srate, unsigned maxWndSmpCnt, unsigned wndSmpCnt, unsigned hopSmpCnt, unsigned flags )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
|
|
||||||
p = mem::allocZ< struct obj_str<T> >();
|
p = mem::allocZ< struct obj_str<T0,T1> >();
|
||||||
|
|
||||||
shift_buf::create( p->sb, procSmpCnt, maxWndSmpCnt, wndSmpCnt, hopSmpCnt );
|
shift_buf::create( p->sb, procSmpCnt, maxWndSmpCnt, wndSmpCnt, hopSmpCnt );
|
||||||
wnd_func::create( p->wf, wnd_func::kHannWndId | wnd_func::kNormByLengthWndFl, maxWndSmpCnt, wndSmpCnt, 0 );
|
wnd_func::create( p->wf, wnd_func::kHannWndId | wnd_func::kNormByLengthWndFl, maxWndSmpCnt, wndSmpCnt, 0 );
|
||||||
@ -593,8 +593,8 @@ namespace cw
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t destroy( struct obj_str<T>*& p )
|
rc_t destroy( struct obj_str<T0,T1>*& p )
|
||||||
{
|
{
|
||||||
if( p != nullptr )
|
if( p != nullptr )
|
||||||
{
|
{
|
||||||
@ -607,15 +607,19 @@ namespace cw
|
|||||||
return kOkRC;
|
return kOkRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
bool exec( struct obj_str<T>* p, const T* x, unsigned xN )
|
bool exec( struct obj_str<T0,T1>* p, const T0* x, unsigned xN )
|
||||||
{
|
{
|
||||||
bool fl = false;
|
bool fl = false;
|
||||||
while( shift_buf::exec(p->sb,x,xN) )
|
while( shift_buf::exec(p->sb,x,xN) )
|
||||||
{
|
{
|
||||||
wnd_func::exec(p->wf, p->sb->outV, p->sb->wndSmpCnt );
|
wnd_func::exec(p->wf, p->sb->outV, p->sb->wndSmpCnt );
|
||||||
|
|
||||||
fft::exec(p->ft, p->wf->outV, p->wf->wndN);
|
// convert float to double
|
||||||
|
T1 cvtV[ p->wf->wndN ];
|
||||||
|
vop::copy(cvtV, p->wf->outV, p->wf->wndN );
|
||||||
|
|
||||||
|
fft::exec(p->ft, cvtV, p->wf->wndN);
|
||||||
|
|
||||||
if( cwIsFlag(p->flags,kCalcHzPvaFl) )
|
if( cwIsFlag(p->flags,kCalcHzPvaFl) )
|
||||||
phs_to_frq::exec(p->pf,p->phsV);
|
phs_to_frq::exec(p->pf,p->phsV);
|
||||||
@ -627,8 +631,8 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t set_window_length( struct obj_str<T>* p, unsigned wndSmpCnt )
|
rc_t set_window_length( struct obj_str<T0,T1>* p, unsigned wndSmpCnt )
|
||||||
{
|
{
|
||||||
rc_t rc;
|
rc_t rc;
|
||||||
|
|
||||||
@ -645,20 +649,20 @@ namespace cw
|
|||||||
|
|
||||||
namespace pv_syn
|
namespace pv_syn
|
||||||
{
|
{
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
struct obj_str
|
struct obj_str
|
||||||
{
|
{
|
||||||
ifft::obj_str<T>* ft;
|
ifft::obj_str<T1>* ft;
|
||||||
wnd_func::obj_str<T>* wf;
|
wnd_func::obj_str<T0>* wf;
|
||||||
ola::obj_str<T>* ola;
|
ola::obj_str<T0>* ola;
|
||||||
|
|
||||||
T* minRphV;
|
T1* minRphV;
|
||||||
T* maxRphV;
|
T1* maxRphV;
|
||||||
T* itrV;
|
T1* itrV;
|
||||||
T* phs0V;
|
T1* phs0V;
|
||||||
T* mag0V;
|
T1* mag0V;
|
||||||
T* phsV;
|
T1* phsV;
|
||||||
T* magV;
|
T1* magV;
|
||||||
|
|
||||||
double outSrate;
|
double outSrate;
|
||||||
unsigned procSmpCnt;
|
unsigned procSmpCnt;
|
||||||
@ -668,15 +672,15 @@ namespace cw
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef obj_str< float > fobj_t;
|
typedef obj_str< float, float > fobj_t;
|
||||||
typedef obj_str< double> dobj_t;
|
typedef obj_str< double, double > dobj_t;
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t create( struct obj_str<T>*& p, unsigned procSmpCnt, const T& outSrate, unsigned wndSmpCnt, unsigned hopSmpCnt, unsigned wndTypeId=wnd_func::kHannWndId )
|
rc_t create( struct obj_str<T0,T1>*& p, unsigned procSmpCnt, const T1& outSrate, unsigned wndSmpCnt, unsigned hopSmpCnt, unsigned wndTypeId=wnd_func::kHannWndId )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
|
|
||||||
p = mem::allocZ< struct obj_str<T> >();
|
p = mem::allocZ< struct obj_str<T0,T1> >();
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
double twoPi = 2.0 * M_PI;
|
double twoPi = 2.0 * M_PI;
|
||||||
@ -689,13 +693,13 @@ namespace cw
|
|||||||
p->hopSmpCnt = hopSmpCnt;
|
p->hopSmpCnt = hopSmpCnt;
|
||||||
p->binCnt = wndSmpCnt / 2 + 1;
|
p->binCnt = wndSmpCnt / 2 + 1;
|
||||||
|
|
||||||
p->minRphV = mem::allocZ<T>( p->binCnt );
|
p->minRphV = mem::allocZ<T1>( p->binCnt );
|
||||||
p->maxRphV = mem::allocZ<T>( p->binCnt );
|
p->maxRphV = mem::allocZ<T1>( p->binCnt );
|
||||||
p->itrV = mem::allocZ<T>( p->binCnt );
|
p->itrV = mem::allocZ<T1>( p->binCnt );
|
||||||
p->phs0V = mem::allocZ<T>( p->binCnt );
|
p->phs0V = mem::allocZ<T1>( p->binCnt );
|
||||||
p->phsV = mem::allocZ<T>( p->binCnt );
|
p->phsV = mem::allocZ<T1>( p->binCnt );
|
||||||
p->mag0V = mem::allocZ<T>( p->binCnt );
|
p->mag0V = mem::allocZ<T1>( p->binCnt );
|
||||||
p->magV = mem::allocZ<T>( p->binCnt );
|
p->magV = mem::allocZ<T1>( p->binCnt );
|
||||||
|
|
||||||
|
|
||||||
wnd_func::create( p->wf, wndTypeId, wndSmpCnt, wndSmpCnt, 0);
|
wnd_func::create( p->wf, wndTypeId, wndSmpCnt, wndSmpCnt, 0);
|
||||||
@ -707,8 +711,8 @@ namespace cw
|
|||||||
// complete revolutions per hop in radians
|
// complete revolutions per hop in radians
|
||||||
p->itrV[k] = twoPi * floor((double)k * hopSmpCnt / wndSmpCnt );
|
p->itrV[k] = twoPi * floor((double)k * hopSmpCnt / wndSmpCnt );
|
||||||
|
|
||||||
p->minRphV[k] = ((T)(k-m)) * hopSmpCnt * twoPi / wndSmpCnt;
|
p->minRphV[k] = ((T1)(k-m)) * hopSmpCnt * twoPi / wndSmpCnt;
|
||||||
p->maxRphV[k] = ((T)(k+m)) * hopSmpCnt * twoPi / wndSmpCnt;
|
p->maxRphV[k] = ((T1)(k+m)) * hopSmpCnt * twoPi / wndSmpCnt;
|
||||||
|
|
||||||
//printf("%f %f %f\n",p->itrV[k],p->minRphV[k],p->maxRphV[k]);
|
//printf("%f %f %f\n",p->itrV[k],p->minRphV[k],p->maxRphV[k]);
|
||||||
}
|
}
|
||||||
@ -716,8 +720,8 @@ namespace cw
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t destroy( struct obj_str<T>*& p )
|
rc_t destroy( struct obj_str<T0,T1>*& p )
|
||||||
{
|
{
|
||||||
if( p != nullptr )
|
if( p != nullptr )
|
||||||
{
|
{
|
||||||
@ -738,8 +742,8 @@ namespace cw
|
|||||||
return kOkRC;
|
return kOkRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T0, typename T1 >
|
||||||
rc_t exec( struct obj_str<T>* p, const T* magV, const T* phsV )
|
rc_t exec( struct obj_str<T0,T1>* p, const T1* magV, const T1* phsV )
|
||||||
{
|
{
|
||||||
|
|
||||||
double twoPi = 2.0 * M_PI;
|
double twoPi = 2.0 * M_PI;
|
||||||
@ -748,7 +752,7 @@ namespace cw
|
|||||||
for(k=0; k<p->binCnt; ++k)
|
for(k=0; k<p->binCnt; ++k)
|
||||||
{
|
{
|
||||||
// phase dist between cur and prv frame
|
// phase dist between cur and prv frame
|
||||||
T dp = phsV[k] - p->phs0V[k];
|
T1 dp = phsV[k] - p->phs0V[k];
|
||||||
|
|
||||||
// dist must be positive (accum phase always increases)
|
// dist must be positive (accum phase always increases)
|
||||||
if( dp < -0.00001 )
|
if( dp < -0.00001 )
|
||||||
@ -774,8 +778,12 @@ namespace cw
|
|||||||
}
|
}
|
||||||
|
|
||||||
ifft::exec_polar( p->ft, magV, phsV );
|
ifft::exec_polar( p->ft, magV, phsV );
|
||||||
|
|
||||||
|
// convert double to float
|
||||||
|
T0 v[ p->ft->outN ];
|
||||||
|
vop::copy( v, p->ft->outV, p->ft->outN );
|
||||||
|
|
||||||
ola::exec( p->ola, p->ft->outV, p->ft->outN );
|
ola::exec( p->ola, v, p->ft->outN );
|
||||||
|
|
||||||
//printf("%i %i\n",p->binCnt,p->ft.binCnt );
|
//printf("%i %i\n",p->binCnt,p->ft.binCnt );
|
||||||
|
|
||||||
@ -978,7 +986,8 @@ namespace cw
|
|||||||
// get the mean output magnitude spectra
|
// get the mean output magnitude spectra
|
||||||
double u1 = vop::mean(X1m,binN);
|
double u1 = vop::mean(X1m,binN);
|
||||||
|
|
||||||
if( p->mix > 0 )
|
//if( p->mix > 0 )
|
||||||
|
if(1)
|
||||||
{
|
{
|
||||||
if( idb > -150.0 )
|
if( idb > -150.0 )
|
||||||
{
|
{
|
||||||
@ -998,8 +1007,8 @@ namespace cw
|
|||||||
if( p->bypassFl )
|
if( p->bypassFl )
|
||||||
vop::copy( p->outMagV, magV, binN );
|
vop::copy( p->outMagV, magV, binN );
|
||||||
else
|
else
|
||||||
vop::mul( p->outMagV, X1m, std::min((T1)4.0,p->ogain), binN);
|
//vop::mul( p->outMagV, X1m, std::min((T1)4.0,p->ogain), binN);
|
||||||
//vop::mul( p->outMagV, X1m, p->ogain, binN);
|
vop::mul( p->outMagV, X1m, p->ogain, binN);
|
||||||
|
|
||||||
vop::copy( p->outPhsV, phsV, binN);
|
vop::copy( p->outPhsV, phsV, binN);
|
||||||
|
|
||||||
@ -1224,7 +1233,6 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rc_t test( const cw::object_t* args );
|
rc_t test( const cw::object_t* args );
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ namespace cw
|
|||||||
namespace dsp
|
namespace dsp
|
||||||
{
|
{
|
||||||
typedef float real_t;
|
typedef float real_t;
|
||||||
typedef real_t sample_t;
|
typedef float sample_t;
|
||||||
typedef real_t srate_t;
|
typedef double fd_real_t;
|
||||||
|
typedef double srate_t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -903,7 +903,7 @@ const cw::flow::sample_t* cw::flow::abuf_get_channel( abuf_t* abuf, unsigned c
|
|||||||
return abuf->buf + (chIdx*abuf->frameN);
|
return abuf->buf + (chIdx*abuf->frameN);
|
||||||
}
|
}
|
||||||
|
|
||||||
cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const sample_t** magV, const sample_t** phsV, const sample_t** hzV )
|
cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const fd_real_t** magV, const fd_real_t** phsV, const fd_real_t** hzV )
|
||||||
{
|
{
|
||||||
for(unsigned i=0; i<chN; ++i)
|
for(unsigned i=0; i<chN; ++i)
|
||||||
if( binN_V[i] > maxBinN_V[i] )
|
if( binN_V[i] > maxBinN_V[i] )
|
||||||
@ -919,9 +919,9 @@ cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, const unsi
|
|||||||
f->maxBinN_V = mem::allocZ<unsigned>(chN);
|
f->maxBinN_V = mem::allocZ<unsigned>(chN);
|
||||||
f->binN_V = mem::allocZ<unsigned>(chN);
|
f->binN_V = mem::allocZ<unsigned>(chN);
|
||||||
f->hopSmpN_V = mem::allocZ<unsigned>(chN);
|
f->hopSmpN_V = mem::allocZ<unsigned>(chN);
|
||||||
f->magV = mem::allocZ<sample_t*>(chN);
|
f->magV = mem::allocZ<fd_real_t*>(chN);
|
||||||
f->phsV = mem::allocZ<sample_t*>(chN);
|
f->phsV = mem::allocZ<fd_real_t*>(chN);
|
||||||
f->hzV = mem::allocZ<sample_t*>(chN);
|
f->hzV = mem::allocZ<fd_real_t*>(chN);
|
||||||
f->readyFlV = mem::allocZ<bool>(chN);
|
f->readyFlV = mem::allocZ<bool>(chN);
|
||||||
|
|
||||||
vop::copy( f->binN_V, binN_V, chN );
|
vop::copy( f->binN_V, binN_V, chN );
|
||||||
@ -932,17 +932,17 @@ cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, const unsi
|
|||||||
{
|
{
|
||||||
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
||||||
{
|
{
|
||||||
f->magV[ chIdx ] = (sample_t*)magV[chIdx];
|
f->magV[ chIdx ] = (fd_real_t*)magV[chIdx];
|
||||||
f->phsV[ chIdx ] = (sample_t*)phsV[chIdx];
|
f->phsV[ chIdx ] = (fd_real_t*)phsV[chIdx];
|
||||||
f->hzV[ chIdx ] = (sample_t*)hzV[chIdx];
|
f->hzV[ chIdx ] = (fd_real_t*)hzV[chIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned maxTotalBinsN = vop::sum( maxBinN_V, chN );
|
unsigned maxTotalBinsN = vop::sum( maxBinN_V, chN );
|
||||||
|
|
||||||
sample_t* buf = mem::allocZ<sample_t>( kFbufVectN * maxTotalBinsN );
|
fd_real_t* buf = mem::allocZ<fd_real_t>( kFbufVectN * maxTotalBinsN );
|
||||||
sample_t* m = buf;
|
fd_real_t* m = buf;
|
||||||
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
for(unsigned chIdx=0; chIdx<chN; ++chIdx)
|
||||||
{
|
{
|
||||||
f->magV[chIdx] = m + 0 * f->binN_V[chIdx];
|
f->magV[chIdx] = m + 0 * f->binN_V[chIdx];
|
||||||
@ -960,7 +960,7 @@ cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, const unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const sample_t** magV, const sample_t** phsV, const sample_t** hzV )
|
cw::flow::fbuf_t* cw::flow::fbuf_create( srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const fd_real_t** magV, const fd_real_t** phsV, const fd_real_t** hzV )
|
||||||
{
|
{
|
||||||
unsigned maxBinN_V[ chN ];
|
unsigned maxBinN_V[ chN ];
|
||||||
unsigned binN_V[ chN ];
|
unsigned binN_V[ chN ];
|
||||||
@ -1367,7 +1367,7 @@ cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* va
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const sample_t** magV, const sample_t** phsV, const sample_t** hzV )
|
cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const fd_real_t** magV, const fd_real_t** phsV, const fd_real_t** hzV )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
fbuf_t* fbuf;
|
fbuf_t* fbuf;
|
||||||
@ -1380,7 +1380,7 @@ cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* var_label
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const sample_t** magV, const sample_t** phsV, const sample_t** hzV )
|
cw::rc_t cw::flow::var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const fd_real_t** magV, const fd_real_t** phsV, const fd_real_t** hzV )
|
||||||
{
|
{
|
||||||
unsigned maxBinN_V[ chN ];
|
unsigned maxBinN_V[ chN ];
|
||||||
unsigned binN_V[ chN ];
|
unsigned binN_V[ chN ];
|
||||||
|
@ -6,6 +6,7 @@ namespace cw
|
|||||||
#define kRealTFl kFloatTFl
|
#define kRealTFl kFloatTFl
|
||||||
typedef dsp::real_t real_t;
|
typedef dsp::real_t real_t;
|
||||||
typedef dsp::sample_t sample_t;
|
typedef dsp::sample_t sample_t;
|
||||||
|
typedef dsp::fd_real_t fd_real_t;
|
||||||
typedef dsp::srate_t srate_t;
|
typedef dsp::srate_t srate_t;
|
||||||
typedef unsigned uint_t;
|
typedef unsigned uint_t;
|
||||||
typedef int int_t;
|
typedef int int_t;
|
||||||
@ -38,11 +39,11 @@ namespace cw
|
|||||||
unsigned* maxBinN_V; // max value that binN_V[i] is allowed to take
|
unsigned* maxBinN_V; // max value that binN_V[i] is allowed to take
|
||||||
unsigned* binN_V; // binN_V[ chN ] count of sample frames per channel
|
unsigned* binN_V; // binN_V[ chN ] count of sample frames per channel
|
||||||
unsigned* hopSmpN_V; // hopSmpN_V[ chN ] hop sample count
|
unsigned* hopSmpN_V; // hopSmpN_V[ chN ] hop sample count
|
||||||
sample_t** magV; // magV[ chN ][ binN ]
|
fd_real_t** magV; // magV[ chN ][ binN ]
|
||||||
sample_t** phsV; // phsV[ chN ][ binN ]
|
fd_real_t** phsV; // phsV[ chN ][ binN ]
|
||||||
sample_t** hzV; // hzV[ chN ][ binN ]
|
fd_real_t** hzV; // hzV[ chN ][ binN ]
|
||||||
bool* readyFlV; // readyFlV[chN] true if this channel is ready to be processed (used to sync. fbuf rate to abuf rate)
|
bool* readyFlV; // readyFlV[chN] true if this channel is ready to be processed (used to sync. fbuf rate to abuf rate)
|
||||||
sample_t* buf; // memory used by this buffer (or NULL if magV,phsV,hzV point are proxied to another buffer)
|
fd_real_t* buf; // memory used by this buffer (or NULL if magV,phsV,hzV point are proxied to another buffer)
|
||||||
} fbuf_t;
|
} fbuf_t;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -191,12 +192,12 @@ namespace cw
|
|||||||
|
|
||||||
void* userPtr; // instance state
|
void* userPtr; // instance state
|
||||||
|
|
||||||
variable_t* varL; // list of all variables on this instance
|
variable_t* varL; // linked list of all variables on this instance
|
||||||
|
|
||||||
unsigned varMapChN; // max count of channels among all variables
|
unsigned varMapChN; // max count of channels (max 'chIdx' + 2) among all variables on this instance, (2=kAnyChIdx+index to count)
|
||||||
unsigned varMapIdN;
|
unsigned varMapIdN; // max 'vid' among all variables on this instance
|
||||||
unsigned varMapN; // varMapN
|
unsigned varMapN; // varMapN = varMapIdN * varMapChN
|
||||||
variable_t** varMapA; // varMapA[ varMapN ]
|
variable_t** varMapA; // varMapA[ varMapN ] = allows fast lookup from ('vid','chIdx) to variable
|
||||||
|
|
||||||
struct instance_str* link;
|
struct instance_str* link;
|
||||||
} instance_t;
|
} instance_t;
|
||||||
@ -234,8 +235,8 @@ namespace cw
|
|||||||
rc_t abuf_set_channel( abuf_t* buf, unsigned chIdx, const sample_t* v, unsigned vN );
|
rc_t abuf_set_channel( abuf_t* buf, unsigned chIdx, const sample_t* v, unsigned vN );
|
||||||
const sample_t* abuf_get_channel( abuf_t* buf, unsigned chIdx );
|
const sample_t* abuf_get_channel( abuf_t* buf, unsigned chIdx );
|
||||||
|
|
||||||
fbuf_t* fbuf_create( srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const sample_t** magV=nullptr, const sample_t** phsV=nullptr, const sample_t** hzV=nullptr );
|
fbuf_t* fbuf_create( srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const fd_real_t** magV=nullptr, const fd_real_t** phsV=nullptr, const fd_real_t** hzV=nullptr );
|
||||||
fbuf_t* fbuf_create( srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const sample_t** magV=nullptr, const sample_t** phsV=nullptr, const sample_t** hzV=nullptr );
|
fbuf_t* fbuf_create( srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const fd_real_t** magV=nullptr, const fd_real_t** phsV=nullptr, const fd_real_t** hzV=nullptr );
|
||||||
void fbuf_destroy( fbuf_t*& buf );
|
void fbuf_destroy( fbuf_t*& buf );
|
||||||
fbuf_t* fbuf_duplicate( const fbuf_t* src );
|
fbuf_t* fbuf_duplicate( const fbuf_t* src );
|
||||||
|
|
||||||
@ -370,8 +371,8 @@ namespace cw
|
|||||||
rc_t var_register_and_set( instance_t* inst, const char* label, unsigned vid, unsigned chIdx, variable_t*& varRef );
|
rc_t var_register_and_set( instance_t* inst, const char* label, unsigned vid, unsigned chIdx, variable_t*& varRef );
|
||||||
|
|
||||||
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned frameN );
|
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned frameN );
|
||||||
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const sample_t** magV=nullptr, const sample_t** phsV=nullptr, const sample_t** hzV=nullptr );
|
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, const unsigned* maxBinN_V, const unsigned* binN_V, const unsigned* hopSmpN_V, const fd_real_t** magV=nullptr, const fd_real_t** phsV=nullptr, const fd_real_t** hzV=nullptr );
|
||||||
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const sample_t** magV=nullptr, const sample_t** phsV=nullptr, const sample_t** hzV=nullptr );
|
rc_t var_register_and_set( instance_t* inst, const char* var_label, unsigned vid, unsigned chIdx, srate_t srate, unsigned chN, unsigned maxBinN, unsigned binN, unsigned hopSmpN, const fd_real_t** magV=nullptr, const fd_real_t** phsV=nullptr, const fd_real_t** hzV=nullptr );
|
||||||
|
|
||||||
inline rc_t _var_register_and_set(cw::flow::instance_t*, unsigned int ) { return kOkRC; }
|
inline rc_t _var_register_and_set(cw::flow::instance_t*, unsigned int ) { return kOkRC; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user