cmProc5.h/c : Added audion in/out cmVectArray's to cmPhat.
This commit is contained in:
parent
3e0ff45946
commit
512171ef9a
41
cmProc5.c
41
cmProc5.c
@ -382,6 +382,9 @@ cmPhat_t* cmPhatAlloc( cmCtx* ctx, cmPhat_t* ap, unsigned chN, unsigned hN, f
|
|||||||
cmFftAllocSR(ctx,&p->fft,NULL,fhN,kToPolarFftFl);
|
cmFftAllocSR(ctx,&p->fft,NULL,fhN,kToPolarFftFl);
|
||||||
cmIFftAllocRS(ctx,&p->ifft,fhN/2 + 1 );
|
cmIFftAllocRS(ctx,&p->ifft,fhN/2 + 1 );
|
||||||
|
|
||||||
|
// allocate the vect array
|
||||||
|
p->ftVa = cmVectArrayAlloc(ctx, kSampleVaFl );
|
||||||
|
|
||||||
if( chN != 0 )
|
if( chN != 0 )
|
||||||
if( cmPhatInit(p,chN,hN,alpha,mult,flags) != cmOkRC )
|
if( cmPhatInit(p,chN,hN,alpha,mult,flags) != cmOkRC )
|
||||||
cmPhatFree(&p);
|
cmPhatFree(&p);
|
||||||
@ -456,10 +459,8 @@ cmRC_t cmPhatInit( cmPhat_t* p, unsigned chN, unsigned hN, float alpha, unsig
|
|||||||
p->mhM = cmMemResizeZ(float, p->mhM, p->binN * chN);
|
p->mhM = cmMemResizeZ(float, p->mhM, p->binN * chN);
|
||||||
cmPhatReset(p);
|
cmPhatReset(p);
|
||||||
|
|
||||||
//if( cmIsFlag(p->flags,kDebugAtPhatFl))
|
if( cmIsFlag(p->flags,kDebugAtPhatFl))
|
||||||
// cmVectArrayAlloc(ctx, &p->ftVa, kSampleVaFl );
|
cmVectArrayClear(p->ftVa);
|
||||||
//else
|
|
||||||
// p->ftVa = NULL;
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@ -659,7 +660,7 @@ cmRC_t cmPhatWrite( cmPhat_t* p, const char* dirStr )
|
|||||||
{
|
{
|
||||||
const char* path = NULL;
|
const char* path = NULL;
|
||||||
|
|
||||||
if( p->ftVa != NULL )
|
if( cmVectArrayCount(p->ftVa) )
|
||||||
if((rc = cmVectArrayWrite(p->ftVa, path = cmFsMakeFn(path,"cmPhatFT","va",dirStr,NULL) )) != cmOkRC )
|
if((rc = cmVectArrayWrite(p->ftVa, path = cmFsMakeFn(path,"cmPhatFT","va",dirStr,NULL) )) != cmOkRC )
|
||||||
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"PHAT debug file write failed.");
|
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"PHAT debug file write failed.");
|
||||||
|
|
||||||
@ -693,7 +694,9 @@ cmReflectCalc_t* cmReflectCalcAlloc( cmCtx* ctx, cmReflectCalc_t* p, const cmGol
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
op->va = cmVectArrayAlloc(ctx,kSampleVaFl);
|
op->phVa = cmVectArrayAlloc(ctx,kSampleVaFl);
|
||||||
|
op->xVa = cmVectArrayAlloc(ctx,kSampleVaFl);
|
||||||
|
op->yVa = cmVectArrayAlloc(ctx,kSampleVaFl);
|
||||||
|
|
||||||
// allocate 'this'
|
// allocate 'this'
|
||||||
if( gsa != NULL )
|
if( gsa != NULL )
|
||||||
@ -723,7 +726,9 @@ cmRC_t cmReflectCalcFree( cmReflectCalc_t** pp )
|
|||||||
if((rc = cmReflectCalcFinal(p)) != cmOkRC )
|
if((rc = cmReflectCalcFinal(p)) != cmOkRC )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
cmVectArrayFree(&p->va);
|
cmVectArrayFree(&p->phVa);
|
||||||
|
cmVectArrayFree(&p->xVa);
|
||||||
|
cmVectArrayFree(&p->yVa);
|
||||||
cmGoldSigFree(&p->gs);
|
cmGoldSigFree(&p->gs);
|
||||||
cmPhatFree(&p->phat);
|
cmPhatFree(&p->phat);
|
||||||
|
|
||||||
@ -803,14 +808,17 @@ cmRC_t cmReflectCalcExec( cmReflectCalc_t* p, const cmSample_t* xV, cmSample_t*
|
|||||||
// execute the correlation
|
// execute the correlation
|
||||||
cmPhatChExec(p->phat,0,0,0);
|
cmPhatChExec(p->phat,0,0,0);
|
||||||
|
|
||||||
// p->phat->xV now holds the correlation result
|
// p->phat->xV[fhN] now holds the correlation result
|
||||||
|
|
||||||
if( p->va != NULL )
|
if( p->phVa != NULL )
|
||||||
cmVectArrayAppendS(p->va,p->phat->xV,p->phat->fhN );
|
cmVectArrayAppendS(p->phVa,p->phat->xV,p->phat->fhN );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmVectArrayAppendS(p->xVa,xV,xyN);
|
||||||
|
cmVectArrayAppendS(p->yVa,yV,xyN);
|
||||||
|
|
||||||
return cmOkRC;
|
return cmOkRC;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -819,14 +827,17 @@ cmRC_t cmReflectCalcWrite( cmReflectCalc_t* p, const char* dirStr )
|
|||||||
{
|
{
|
||||||
cmRC_t rc = cmOkRC;
|
cmRC_t rc = cmOkRC;
|
||||||
|
|
||||||
if( p->va != NULL)
|
if( p->phVa != NULL)
|
||||||
{
|
{
|
||||||
const char* path = NULL;
|
//const char* path = NULL;
|
||||||
|
|
||||||
if((rc = cmVectArrayWrite(p->va, path = cmFsMakeFn(path,"reflect_calc","va",dirStr,NULL) )) != cmOkRC )
|
cmVectArrayWriteDirFn(p->xVa, dirStr, "reflect_calc_x.va" );
|
||||||
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Reflect calc file write failed.");
|
cmVectArrayWriteDirFn(p->yVa, dirStr, "reflect_calc_y.va" );
|
||||||
|
cmVectArrayWriteDirFn(p->phVa,dirStr, "reflect_calc_ph.va");
|
||||||
|
|
||||||
cmFsFreeFn(path);
|
//if((rc = cmVectArrayWrite(p->phVa, path = cmFsMakeFn(path,"reflect_calc","va",dirStr,NULL) )) != cmOkRC )
|
||||||
|
// rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Reflect calc file write failed.");
|
||||||
|
//cmFsFreeFn(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -204,7 +204,10 @@ extern "C" {
|
|||||||
unsigned xi; // index into gs->ch[0].mdV[] of the next sample to output
|
unsigned xi; // index into gs->ch[0].mdV[] of the next sample to output
|
||||||
bool zeroFl;
|
bool zeroFl;
|
||||||
cmPhat_t* phat;
|
cmPhat_t* phat;
|
||||||
cmVectArray_t* va;
|
|
||||||
|
cmVectArray_t* phVa;
|
||||||
|
cmVectArray_t* xVa;
|
||||||
|
cmVectArray_t* yVa;
|
||||||
} cmReflectCalc_t;
|
} cmReflectCalc_t;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user