cmProc5.h/c : Added cmReflectCalcWrite().
This commit is contained in:
parent
28d2de022a
commit
da34a3e4a5
28
cmProc5.c
28
cmProc5.c
@ -694,6 +694,8 @@ cmRC_t cmReflectCalcFree( cmReflectCalc_t** pp )
|
|||||||
|
|
||||||
cmReflectCalc_t* p = *pp;
|
cmReflectCalc_t* p = *pp;
|
||||||
|
|
||||||
|
cmReflectCalcWrite(p,"/Users/kevin/temp/cmkc");
|
||||||
|
|
||||||
if((rc = cmReflectCalcFinal(p)) != cmOkRC )
|
if((rc = cmReflectCalcFinal(p)) != cmOkRC )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@ -755,9 +757,12 @@ cmRC_t cmReflectCalcFinal( cmReflectCalc_t* p )
|
|||||||
return cmOkRC;
|
return cmOkRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t xV, cmSample_t* yV, unsigned xyN )
|
cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t* xV, cmSample_t* yV, unsigned xyN )
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
// feed audio into the PHAT's buffer
|
||||||
|
cmPhatExec(p->phat,xV,xyN);
|
||||||
|
|
||||||
for(i=0; i<xyN; ++i,++p->xi)
|
for(i=0; i<xyN; ++i,++p->xi)
|
||||||
{
|
{
|
||||||
@ -766,12 +771,16 @@ cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t xV, cmSample_t* y
|
|||||||
else
|
else
|
||||||
yV[i] = 0;
|
yV[i] = 0;
|
||||||
|
|
||||||
|
// if the PHAT has a complete buffer
|
||||||
if( p->xi == p->phat->fhN )
|
if( p->xi == p->phat->fhN )
|
||||||
{
|
{
|
||||||
p->xi = 0;
|
p->xi = 0;
|
||||||
|
|
||||||
|
// execute the correlation
|
||||||
cmPhatChExec(p->phat,0,0,0);
|
cmPhatChExec(p->phat,0,0,0);
|
||||||
|
|
||||||
|
// p->phat->xV now holds the correlation result
|
||||||
|
|
||||||
if( p->va != NULL )
|
if( p->va != NULL )
|
||||||
cmVectArrayAppendS(p->va,p->phat->xV,p->phat->fhN );
|
cmVectArrayAppendS(p->va,p->phat->xV,p->phat->fhN );
|
||||||
}
|
}
|
||||||
@ -781,3 +790,20 @@ cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t xV, cmSample_t* y
|
|||||||
return cmOkRC;
|
return cmOkRC;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmRC_t cmReflectCalcWrite( cmReflectCalc_t* p, const char* dirStr )
|
||||||
|
{
|
||||||
|
cmRC_t rc = cmOkRC;
|
||||||
|
|
||||||
|
if( p->va != NULL)
|
||||||
|
{
|
||||||
|
const char* path = NULL;
|
||||||
|
|
||||||
|
if((rc = cmVectArrayWrite(p->va, path = cmFsMakeFn(path,"reflect_calc","va",dirStr,NULL) )) != cmOkRC )
|
||||||
|
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Reflect calc file write failed.");
|
||||||
|
|
||||||
|
cmFsFreeFn(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
@ -208,11 +208,11 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
cmReflectCalc_t* cmReflectCalcAlloc( cmCtx* ctx, cmReflectCalc_t* p, const cmGoldSigArg_t* gsa, float phat_alpha, unsigned phat_mult );
|
cmReflectCalc_t* cmReflectCalcAlloc( cmCtx* ctx, cmReflectCalc_t* p, const cmGoldSigArg_t* gsa, float phat_alpha, unsigned phat_mult );
|
||||||
cmRC_t cmReflectCalcFree( cmReflectCalc_t** pp );
|
cmRC_t cmReflectCalcFree( cmReflectCalc_t** pp );
|
||||||
cmRC_t cmReflectCalcInit( cmReflectCalc_t* p, const cmGoldSigArg_t* gsa, float phat_alpha, unsigned phat_mult );
|
cmRC_t cmReflectCalcInit( cmReflectCalc_t* p, const cmGoldSigArg_t* gsa, float phat_alpha, unsigned phat_mult );
|
||||||
cmRC_t cmReflectCalcFinal( cmReflectCalc_t* p );
|
cmRC_t cmReflectCalcFinal( cmReflectCalc_t* p );
|
||||||
cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t xV, cmSample_t* yV, unsigned xyN );
|
cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t* xV, cmSample_t* yV, unsigned xyN );
|
||||||
|
cmRC_t cmReflectCalcWrite( cmReflectCalc_t* p, const char* dirStr );
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user