cmProc5.h : Added cmVectArray's uVa and fVa.

This commit is contained in:
kevin 2015-08-27 17:49:24 -04:00
parent a6ed3110e4
commit b1a108abd3
2 changed files with 24 additions and 6 deletions

View File

@ -918,9 +918,12 @@ cmNlmsEc_t* cmNlmsEcAlloc( cmCtx* ctx, cmNlmsEc_t* ap, float mu, unsigned hN, un
{ {
cmNlmsEc_t* p = cmObjAlloc(cmNlmsEc_t,ctx,ap); cmNlmsEc_t* p = cmObjAlloc(cmNlmsEc_t,ctx,ap);
// allocate the vect array // allocate the vect array's
p->uVa = cmVectArrayAlloc(ctx, kFloatVaFl );
p->fVa = cmVectArrayAlloc(ctx, kFloatVaFl );
p->eVa = cmVectArrayAlloc(ctx, kFloatVaFl ); p->eVa = cmVectArrayAlloc(ctx, kFloatVaFl );
if( mu != 0 ) if( mu != 0 )
if( cmNlmsEcInit(p,mu,hN,delayN) != cmOkRC ) if( cmNlmsEcInit(p,mu,hN,delayN) != cmOkRC )
cmNlmsEcFree(&p); cmNlmsEcFree(&p);
@ -1024,13 +1027,27 @@ cmRC_t cmNlmsEcExec( cmNlmsEc_t* p, const cmSample_t* xV, const cmSample_t*
} }
cmVectArrayAppendS(p->uVa,xV,xyN);
cmVectArrayAppendS(p->fVa,fV,xyN);
cmVectArrayAppendS(p->eVa,yV,xyN);
return cmOkRC; return cmOkRC;
} }
cmRC_t cmNlmsEcWrite( cmNlmsEc_t* p, const cmChar_t* dirStr ) cmRC_t cmNlmsEcWrite( cmNlmsEc_t* p, const cmChar_t* dirStr )
{ {
if( p->uVa != NULL )
cmVectArrayWriteDirFn(p->uVa, dirStr, "nlms_unfiltered.va");
if( p->fVa != NULL )
cmVectArrayWriteDirFn(p->fVa, dirStr, "nlms_filtered.va");
if( p->eVa != NULL ) if( p->eVa != NULL )
cmVectArrayWriteDirFn(p->eVa,dirStr, "nlms_err.va"); cmVectArrayWriteDirFn(p->eVa, dirStr, "nlms_out.va");
return cmOkRC; return cmOkRC;
} }

View File

@ -236,9 +236,10 @@ extern "C" {
unsigned delayN; // fixed delay to apply to align xV with fV. unsigned delayN; // fixed delay to apply to align xV with fV.
double* wV; // wV[hN] filter weights double* wV; // wV[hN] filter weights
double* hV; // hV[hN] filter delay line double* hV; // hV[hN] filter delay line
unsigned w0i; // The index into hV[] of the start of the delay line.
unsigned w0i; cmVectArray_t* uVa;
cmVectArray_t* fVa;
cmVectArray_t* eVa; cmVectArray_t* eVa;
} cmNlmsEc_t; } cmNlmsEc_t;